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

📄 borrowpanel.java

📁 Java实现的图书管理系统
💻 JAVA
字号:
/* * BorrowPanel.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 BorrowPanel extends JPanel {        private MyClientTable table;    private BtAL btAL=new BtAL();    private BtBorrowAL btBorrowAL=new BtBorrowAL();    private JTextField tf;    private BusinessLogic bl;        /** Creates a new instance of BorrowPanel */    public BorrowPanel(BusinessLogic bl)     {        this.bl=bl;        this.setLayout(new BorderLayout());             //initial the query field        JLabel lb=new JLabel("书名:");        tf=new JTextField("",15);                JButton bt=new JButton("查询");        bt.addActionListener(btAL);        JButton bt_borrow=new JButton("借阅");        bt_borrow.addActionListener(btBorrowAL);                JPanel panel=new JPanel();        panel.add(lb);        panel.add(tf);        panel.add(bt);        panel.add(bt_borrow);        panel.setBorder(new EtchedBorder());                        this.add(panel,"North");              //initial the talbe         Vector vRow=new Vector();        Vector vCol=new Vector();                vCol.add("AA");        vCol.add("BB");        vCol.add("CC");        vRow.add(vCol);        vCol=new Vector();        vCol.add("AA-1");        vCol.add("BB-1");        vCol.add("CC-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.getQueryBook(str);                          table.setModel(new DataModel(v));                                            }    }        class BtBorrowAL 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 bookId=(String)table.getValueAt(rows[i],0);                 bl.borrowBook(bookId);             }                                  }    }        public MyClientTable getTable()    {        return table;    }    }

⌨️ 快捷键说明

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