📄 pnlbookmanage_add.java~6~
字号:
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.*;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JScrollPane;
import java.sql.ResultSet;
import javax.swing.JComboBox;
public class pnlBookManage_add extends JPanel {
FrmBook fm;
public pnlBookManage_add(FrmBook f) {
fm=f;
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
txtNumber.setBackground(new Color(235, 173, 214));
txtNumber.setText("");
txtNumber.setBounds(new Rectangle(45, 11, 83, 28));
jLabel1.setText("编号:");
jLabel1.setBounds(new Rectangle(12, 10, 38, 28));
jLabel2.setText("名称:");
jLabel2.setBounds(new Rectangle(139, 10, 38, 26));
txtName.setBounds(new Rectangle(174, 11, 83, 28));
jLabel3.setText("作者:");
jLabel3.setBounds(new Rectangle(271, 11, 49, 25));
txtAuthor.setBounds(new Rectangle(311, 11, 83, 28));
jLabel4.setText("价格:");
jLabel4.setBounds(new Rectangle(406, 12, 38, 24));
txtPrice.setBounds(new Rectangle(437, 11, 83, 28));
jLabel5.setText("出版社:");
jLabel5.setBounds(new Rectangle(10, 65, 41, 26));
txtPublish.setText("");
txtPublish.setBounds(new Rectangle(47, 59, 92, 28));
jLabel6.setText("入库日期:");
jLabel6.setBounds(new Rectangle(147, 57, 65, 31));
jLabel7.setText("是否在库:");
jLabel7.setBounds(new Rectangle(438, 53, 57, 35));
txtIsExist.setText("");
txtIsExist.setBounds(new Rectangle(494, 59, 36, 28));
btnAdd.setBounds(new Rectangle(125, 98, 79, 38));
btnAdd.setText("入库");
btnAdd.addActionListener(new pnlBookManage_add_btnAdd_actionAdapter(this));
btnReset.setBounds(new Rectangle(260, 98, 79, 38));
btnReset.setText("重置");
btnReset.addActionListener(new pnlBookManage_add_btnReset_actionAdapter(this));
cmbYear.setBounds(new Rectangle(197, 55, 42, 31));
cmbMonth.setBounds(new Rectangle(271, 54, 42, 31));
cmbDay.setBounds(new Rectangle(338, 55, 42, 31));
jLabel8.setText("年");
jLabel8.setBounds(new Rectangle(249, 54, 37, 31));
jLabel9.setText("月");
jLabel9.setBounds(new Rectangle(323, 53, 32, 31));
jLabel10.setText("日");
jLabel10.setBounds(new Rectangle(388, 53, 28, 30));
this.add(txtNumber);
this.add(jLabel1);
this.add(jLabel2);
this.add(txtName);
this.add(jLabel3);
this.add(txtAuthor);
this.add(jLabel4);
this.add(txtPrice);
this.add(jLabel5);
this.add(btnAdd);
this.add(btnReset);
this.add(txtPublish);
this.add(jLabel6);
this.add(cmbYear);
this.add(jLabel8);
this.add(cmbMonth);
this.add(jLabel9);
this.add(cmbDay);
this.add(jLabel7);
this.add(jLabel10);
this.add(txtIsExist);
}
JTextField txtNumber = new JTextField();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField txtName = new JTextField();
JLabel jLabel3 = new JLabel();
JTextField txtAuthor = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField txtPrice = new JTextField();
JLabel jLabel5 = new JLabel();
JTextField txtPublish = new JTextField();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JTextField txtIsExist = new JTextField();
JButton btnAdd = new JButton();
JButton btnReset = new JButton();
JComboBox cmbYear = new JComboBox();
JComboBox cmbMonth = new JComboBox();
JComboBox cmbDay = new JComboBox();
JLabel jLabel8 = new JLabel();
JLabel jLabel9 = new JLabel();
JLabel jLabel10 = new JLabel();
public void btnReset_actionPerformed(ActionEvent e) {
txtNumber.setText("");
txtName.setText("");
txtAuthor.setText("");
txtPrice.setText("");
txtPublish.setText("");
txtIsExist.setText("");
}
public void btnAdd_actionPerformed(ActionEvent e) {
bookadd_condb bc=new bookadd_condb();
String AddDate=cmbYear.getSelectedItem()+"-"+cmbMonth.getSelectedItem()+"-"+cmbDay.getSelectedItem();
bc.BookAdd(txtNumber.getText(),txtName.getText(),txtAuthor.getText(),Integer.parseInt(txtPrice.getText()),txtPublish.getText(), AddDate,Integer.parseInt(txtIsExist.getText()));
bookadd_condb.initSearch();
bookadd_condb.initInfo(fm.tblData,bookadd_condb.rs);
ResultSet rstemp=bookadd_condb.rsBook();
String tab="bookinfo";
fm.DataPane(rstemp,tab);
fm.page=0;
}
}
class pnlBookManage_add_btnAdd_actionAdapter implements ActionListener {
private pnlBookManage_add adaptee;
pnlBookManage_add_btnAdd_actionAdapter(pnlBookManage_add adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnAdd_actionPerformed(e);
}
}
class pnlBookManage_add_btnReset_actionAdapter implements ActionListener {
private pnlBookManage_add adaptee;
pnlBookManage_add_btnReset_actionAdapter(pnlBookManage_add adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnReset_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -