📄 borrowfram.java
字号:
jComboBox2.setForeground(Color.black);
jComboBox2.setBorder(BorderFactory.createEtchedBorder());
jComboBox2.setMinimumSize(new Dimension(31, 25));
jComboBox2.setLightWeightPopupEnabled(true);
jComboBox2.setMaximumRowCount(8);
jComboBox1.setBounds(new Rectangle(14, 10, 103, 24));
jTextField6.setText("");
jTextField6.setBounds(new Rectangle(135, 11, 112, 23));
jButton5.setBounds(new Rectangle(261, 10, 73, 23));
jButton5.setFont(new java.awt.Font("Dialog", 0, 13));
jButton5.setBorder(border19);
jButton5.setText("查 询");
jButton6.setText("取 消");
jButton6.setBounds(new Rectangle(355, 11, 71, 22));
jButton6.setFont(new java.awt.Font("Dialog", 0, 13));
jButton6.setBorder(BorderFactory.createRaisedBevelBorder());
jButton7.setBounds(new Rectangle(440, 11, 71, 22));
jButton7.setFont(new java.awt.Font("Dialog", 0, 13));
jButton7.setBorder(BorderFactory.createRaisedBevelBorder());
jButton7.setText("退 出");
jLabel3.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel3.setText("图书编号:");
jLabel3.setBounds(new Rectangle(233, 12, 77, 24));
jButton8.setBounds(new Rectangle(458, 13, 72, 24));
jButton8.setFont(new java.awt.Font("Dialog", 0, 13));
jButton8.setBorder(BorderFactory.createRaisedBevelBorder());
jButton8.setText("借 出");
jButton9.setText("取 消");
jButton2.setActionCommand("取消1");
jButton6.setActionCommand("取消2");
jButton9.setActionCommand("取消3");
jButton3.setActionCommand("查询1");
jButton5.setActionCommand("查询2");
//------------------为按钮添加热键------------------------
jButton1.setMnemonic('o');
jButton2.setMnemonic('q');
jButton3.setMnemonic('l');
jButton5.setMnemonic('l');
jButton6.setMnemonic('q');
jButton8.setMnemonic('o');
jButton9.setMnemonic('q');
//-------------------------设置ESC和ENTER键为快捷键-----------------------------------
//jButton1.registerKeyboardAction(enter,KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),
// JComponent.WHEN_IN_FOCUSED_WINDOW);
//jButton8.registerKeyboardAction(enter, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
// JComponent.WHEN_IN_FOCUSED_WINDOW);
//
jButton7.registerKeyboardAction(esc,
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,
0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
jButton4.registerKeyboardAction(esc,
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,
0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
//=========================设置显示内容或字体和字号==================================
jButton9.setBounds(new Rectangle(458, 44, 72, 23));
jButton9.setFont(new java.awt.Font("Dialog", 0, 13));
jButton9.setBorder(BorderFactory.createRaisedBevelBorder());
jLabel6.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel6.setText("续借日期:");
jLabel6.setBounds(new Rectangle(19, 41, 77, 31));
jTextField8.setBounds(new Rectangle(81, 11, 135, 24));
jTextField8.setFont(new java.awt.Font("Dialog", 0, 14));
jTextField8.setText("");
jLabel7.setBounds(new Rectangle(233, 44, 79, 24));
jLabel7.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel7.setText("应还日期:");
jLabel8.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel8.setText("读者编号:");
jLabel8.setBounds(new Rectangle(17, 11, 70, 24));
jTextField9.setFont(new java.awt.Font("Dialog", 0, 14));
jTextField9.setText("");
jTextField9.setBounds(new Rectangle(298, 13, 135, 24));
//========================往面版添加组件===============================
jPanel5.add(jTextField1, null);
jPanel5.add(jLabel1, null);
jPanel5.add(jLabel4, null);
jPanel5.add(n, null);
jPanel5.add(jLabel2, null);
jPanel5.add(jTextField2, null);
jPanel5.add(jLabel5, null);
jPanel5.add(n1, null);
jPanel5.add(jButton2, null);
jPanel5.add(jButton1, null);
jPanel1.add(jPanel6, null);
jPanel6.add(jScrollPane1, null);
jPanel6.add(jPanel7, null);
jScrollPane1.getViewport().add(jTable1, null);
jPanel7.add(jTextField3, null);
jPanel7.add(jButton3, null);
jPanel7.add(jButton4, null);
jPanel7.add(jButton10, null);
jPanel7.add(jComboBox2, null);
jTabbedPane1.add(jPanel1, "借阅图书");
jTabbedPane1.add(jPanel2, "续借图书");
jPanel1.add(jPanel5, null);
jPanel10.add(jComboBox1, null);
jPanel10.add(jButton5, null);
jPanel10.add(jTextField6, null);
jPanel10.add(jButton6, null);
jPanel10.add(jButton7, null);
jPanel8.add(jScrollPane2, null);
jPanel8.add(jPanel10, null);
jScrollPane2.getViewport().add(jTable2, null);
jPanel9.add(jButton9, null);
jPanel9.add(n3, null);
jPanel9.add(jLabel7, null);
jPanel9.add(jLabel3, null);
jPanel9.add(jTextField9, null);
jPanel9.add(jButton8, null);
jPanel9.add(jTextField8, null);
jPanel9.add(jLabel8, null);
jPanel9.add(n2, null);
jPanel9.add(jLabel6, null);
jPanel2.add(jPanel8, null);
jPanel2.add(jPanel9, null);
this.getContentPane().add(jTabbedPane1, null);
//---------------为退出,查询,确定和取消按钮添加监听器--------------------
jButton4.addActionListener(esc);
jButton7.addActionListener(esc);
jButton6.addActionListener(new Quxiao(this));
jButton9.addActionListener(new Quxiao(this));
jButton2.addActionListener(new Quxiao(this));
jButton1.setActionCommand("确定1");
jButton8.setActionCommand("确定2");
jButton1.addActionListener(new Queding(this));
jButton8.addActionListener(new Queding(this));
jButton3.addActionListener(new Chaxun1(this));
jButton5.addActionListener(new Chaxun(this));
this.setVisible(false);
}
//-------------------------ENTER和ESC键设置为快捷键------------------------------
class EscJian
implements ActionListener {
public void actionPerformed(ActionEvent e) {
Object obj1 = e.getSource();
if (obj1 == jButton4 || obj1 == jButton7) {
jButton4_performed(e);
}
}
}
void jButton4_performed(ActionEvent e) {
int s = JOptionPane.showConfirmDialog(null, "你真的确定要退出吗", "信息提示",
JOptionPane.YES_NO_OPTION);
if (s == JOptionPane.YES_OPTION) {
this.dispose();
}
else if (s == JOptionPane.NO_OPTION) {
this.show();
}
}
// if (obj == jButton1 || obj == jButton8) {
// jButton1_performed(e);
// }
// }
// }
// void jButton1_performed(ActionEvent e)
// {
//
// }
public static void main(String[] args) {
BorrowFram borrowFrame = new BorrowFram(null);
borrowFrame.setSize(616, 410);
borrowFrame.setLocation(280, 178);
borrowFrame.setVisible(true);
}
JTabbedPane jTabbedPane1 = new JTabbedPane();
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JPanel jPanel5 = new JPanel();
TitledBorder titledBorder1;
JLabel jLabel1 = new JLabel();
TitledBorder titledBorder2;
JTextField jTextField1 = new JTextField();
JLabel jLabel2 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JPanel jPanel6 = new JPanel();
JTextField jTextField2 = new JTextField();
JPanel jPanel7 = new JPanel();
JScrollPane jScrollPane1 = new JScrollPane();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JTextField jTextField3 = new JTextField();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
ButtonGroup btg = new ButtonGroup();
JPanel jPanel8 = new JPanel();
JPanel jPanel9 = new JPanel();
JPanel jPanel10 = new JPanel();
JScrollPane jScrollPane2 = new JScrollPane();
//------给jtable1添加行和列-------
ArrayList arraylist1 = new ArrayList();
String[] s1 = {
"图书编号", "图书名称", "类别", "定价",
"作者", "出版社", "存放位置", "库存图书", "借出图书", "状态"};
JTableModle jtablemodle1 = new JTableModle (arraylist1, s1);
JTable jTable1 = new JTable(jtablemodle1);
//------给jtable2添加行和列-------
ArrayList arraylist = new ArrayList();
String[] s = {//, "图书名称"
"读者编号", "图书编号"
, "出借日期", "应还日期", "应付罚金", "备注"};
JTableModle jtablemodle = new JTableModle(arraylist, s);
JTable jTable2 = new JTable(jtablemodle);
JComboBox jComboBox1 = new JComboBox();
JTextField jTextField6 = new JTextField();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
JButton jButton7 = new JButton();
JLabel jLabel3 = new JLabel();
JButton jButton8 = new JButton();
JButton jButton9 = new JButton();
JLabel jLabel6 = new JLabel();
JTextField jTextField8 = new JTextField();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JTextField jTextField9 = new JTextField();
Border border1;
Border border2;
Border border3;
Border border4;
Border border5;
Border border6;
Border border7;
Border border8;
Border border9;
Border border10;
Border border11;
Border border12;
Border border13;
Border border14;
Border border15;
Border border16;
Border border17;
Border border18;
Border border19;
EscJian esc = new EscJian();
JButton jButton10 = new JButton();
JComboBox jComboBox2 = new JComboBox();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -