⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 returnpanel.java

📁 Java实现的图书管理系统
💻 JAVA
字号:
/* * ReturnPanel.java * * Created on 2003年5月9日, 下午5:34 *//** * * @author  administrator */import java.awt.*;import javax.swing.*;import java.awt.event.*;import javax.swing.event.*;import java.util.*;import javax.swing.border.*;class ReturnPanel extends JPanel {        private MyClientTable table;    private BtAL btAL=new BtAL();    private BtReturnAL btReturnAL=new BtReturnAL();    private JTextField tf;    private BusinessLogic bl;        /** Creates a new instance of ReturnPanel */    public ReturnPanel(BusinessLogic bl)     {        this.bl=bl;                this.setLayout(new BorderLayout());             //initial the query field        JLabel lb=new JLabel("书ID:");        tf=new JTextField("",15);        JButton bt=new JButton("查询");        bt.addActionListener(btAL);        JButton bt_return=new JButton("归还");        bt_return.addActionListener(btReturnAL);                JPanel panel=new JPanel();        panel.add(lb);        panel.add(tf);        panel.add(bt);        panel.add(bt_return);        panel.setBorder(new EtchedBorder());                this.add(panel,"North");              //initial the talbe         Vector vRow=new Vector();        Vector vCol=new Vector();                vCol.add("AAA");        vCol.add("BBB");        vCol.add("CCC");        vRow.add(vCol);        vCol=new Vector();        vCol.add("AAA-1");        vCol.add("BBB-1");        vCol.add("CCC-1");        vRow.add(vCol);                table=new MyClientTable(vRow);        JScrollPane scTable=new JScrollPane(table);        this.add(scTable,"Center");    }        class BtAL implements ActionListener    {         public void actionPerformed(ActionEvent e)          {             String str=tf.getText();                          Vector v=bl.getQueryBorrowedBook(str);                          table.setModel(new DataModel(v));                                            }    }        class BtReturnAL implements ActionListener    {         public void actionPerformed(ActionEvent e)          {             int rowCount=table.getSelectedRowCount();             if(rowCount==0)                 return;                          int[] rows=table.getSelectedRows();             int i=0;             for(i=0;i<rowCount;i++)             {                 String borrowId=(String)table.getValueAt(rows[i],0);                 bl.returnBook(borrowId);             }                          Vector v=bl.getBorrowedBook("");             table.setModel(new DataModel(v));                     }    }        public MyClientTable getTable()    {        return table;    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -