📄 pnlsearch_author.java~2~
字号:
import java.awt.BorderLayout;
import javax.swing.JPanel;
import java.sql.ResultSet;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class pnlSearch_Author extends JPanel {
FrmBook fm;
JLabel jLabel1 = new JLabel();
JTextField txtAuthor = new JTextField();
JButton btnSearch = new JButton();
JButton btnReset = new JButton();
public pnlSearch_Author(FrmBook f) {
fm=f;
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
jLabel1.setText("请输入作者:");
jLabel1.setBounds(new Rectangle(24, 14, 75, 34));
txtAuthor.setText("");
txtAuthor.setBounds(new Rectangle(106, 13, 125, 33));
btnSearch.setBounds(new Rectangle(59, 60, 68, 39));
btnSearch.setText("查询");
btnSearch.addActionListener(new
pnlSearch_Author_btnSearch_actionAdapter(this));
btnReset.setBounds(new Rectangle(162, 60, 68, 39));
btnReset.setText("重置");
btnReset.addActionListener(new pnlSearch_Author_btnReset_actionAdapter(this));
this.add(jLabel1);
this.add(btnSearch);
this.add(btnReset);
this.add(txtAuthor);
}
public void btnReset_actionPerformed(ActionEvent e) {
txtAuthor.setText("");
}
public void btnSearch_actionPerformed(ActionEvent e) {
ResultSet rstemp;
rstemp=bookadd_condb.SearchAuthor(txtAuthor.getText());
bookadd_condb.initInfo(fm.tblData,rstemp);
String tab="rstemp";
fm.DataPane(rstemp,tab);
}
}
class pnlSearch_Author_btnSearch_actionAdapter implements ActionListener {
private pnlSearch_Author adaptee;
pnlSearch_Author_btnSearch_actionAdapter(pnlSearch_Author adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnSearch_actionPerformed(e);
}
}
class pnlSearch_Author_btnReset_actionAdapter implements ActionListener {
private pnlSearch_Author adaptee;
pnlSearch_Author_btnReset_actionAdapter(pnlSearch_Author adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnReset_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -