📄 pnlbookmanage_modifytosearch.java~1~
字号:
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.border.TitledBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.ArrayList;
public class pnlBookManage_ModifyToSearch extends JPanel {
FrmBook fm;
public pnlBookManage_ModifyToSearch(FrmBook f) {
fm=f;
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
jLabel1.setFont(new java.awt.Font("Dialog", Font.BOLD, 15));
jLabel1.setText("请输入要修改的图书编号:");
jLabel1.setBounds(new Rectangle(8, 11, 194, 32));
txtNumber.setText("");
txtNumber.setBounds(new Rectangle(198, 14, 122, 30));
btnModify.setBounds(new Rectangle(342, 9, 77, 37));
btnModify.setText("修改");
btnModify.addActionListener(new
pnlBookManage_ModifyToSearch_btnModify_actionAdapter(this));
btnReset.setBounds(new Rectangle(425, 9, 77, 37));
btnReset.setText("重置");
btnReset.addActionListener(new
pnlBookManage_ModifyToSearch_btnReset_actionAdapter(this));
jLabel2.setBorder(titledBorder1);
jLabel2.setBounds(new Rectangle(12, 49, 463, 101));
jLabel3.setFont(new java.awt.Font("Dialog", Font.BOLD, 20));
jLabel3.setText("我要查找");
jLabel3.setBounds(new Rectangle(28, 59, 106, 36));
jLabel4.setText("书名:");
jLabel4.setBounds(new Rectangle(146, 64, 38, 29));
txtName.setText("");
txtName.setBounds(new Rectangle(198, 59, 122, 30));
jLabel5.setText("作者:");
jLabel5.setBounds(new Rectangle(22, 102, 46, 27));
txtAuthor.setBounds(new Rectangle(54, 103, 80, 31));
jLabel6.setText("出版社:");
jLabel6.setBounds(new Rectangle(145, 100, 54, 31));
txtPublish.setText("");
txtPublish.setBounds(new Rectangle(198, 104, 122, 30));
btnSearch.setBounds(new Rectangle(342, 72, 77, 37));
btnSearch.setText("查找");
btnSearch.addActionListener(new
pnlBookManage_ModifyToSearch_btnSearch_actionAdapter(this));
this.add(jLabel1);
this.add(txtNumber);
this.add(btnModify);
this.add(btnReset);
this.add(jLabel3);
this.add(txtAuthor);
this.add(txtName);
this.add(jLabel4);
this.add(txtPublish);
this.add(jLabel6);
this.add(jLabel5);
this.add(btnSearch);
this.add(jLabel2);
}
JLabel jLabel1 = new JLabel();
public static JTextField txtNumber = new JTextField();
JButton btnModify = new JButton();
JButton btnReset = new JButton();
JLabel jLabel2 = new JLabel();
TitledBorder titledBorder1 = new TitledBorder("");
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JTextField txtName = new JTextField();
JLabel jLabel5 = new JLabel();
JTextField txtAuthor = new JTextField();
JLabel jLabel6 = new JLabel();
JTextField txtPublish = new JTextField();
JButton btnSearch = new JButton();
public void btnSearch_actionPerformed(ActionEvent e) {
ResultSet rs2=bookadd_condb.SearchToModify(txtName.getText(),txtAuthor.getText(),txtPublish.getText());
bookadd_condb.initInfo(fm.tblData,rs2);
}
public void btnReset_actionPerformed(ActionEvent e) {
txtNumber.setText("");
}
public void btnModify_actionPerformed(ActionEvent e) {
ArrayList arr=new ArrayList();
arr=bookadd_condb.ShowModifyData(txtNumber.getText());
if(arr.size()>0)
{
PnlBookManage_Modify bm=new PnlBookManage_Modify(fm);
fm.spnV.setTopComponent(bm);
}
}
}
class pnlBookManage_ModifyToSearch_btnModify_actionAdapter implements
ActionListener {
private pnlBookManage_ModifyToSearch adaptee;
pnlBookManage_ModifyToSearch_btnModify_actionAdapter(
pnlBookManage_ModifyToSearch adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnModify_actionPerformed(e);
}
}
class pnlBookManage_ModifyToSearch_btnReset_actionAdapter implements
ActionListener {
private pnlBookManage_ModifyToSearch adaptee;
pnlBookManage_ModifyToSearch_btnReset_actionAdapter(
pnlBookManage_ModifyToSearch adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnReset_actionPerformed(e);
}
}
class pnlBookManage_ModifyToSearch_btnSearch_actionAdapter implements
ActionListener {
private pnlBookManage_ModifyToSearch adaptee;
pnlBookManage_ModifyToSearch_btnSearch_actionAdapter(
pnlBookManage_ModifyToSearch adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnSearch_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -