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

📄 pnlsearch_group.java~5~

📁 这是我在北大青鸟的第一学期的一个毕业设计
💻 JAVA~5~
字号:


import java.awt.BorderLayout;

import javax.swing.JPanel;
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;
import java.sql.ResultSet;

public class pnlSearch_Group extends JPanel {
    FrmBook fm;
    JLabel jLabel1 = new JLabel();
    JTextField txtBookName = new JTextField();
    JLabel jLabel2 = new JLabel();
    JTextField txtAuthor = new JTextField();
    JLabel jLabel3 = new JLabel();
    JTextField txtPublish = new JTextField();
    JButton btnSearch = new JButton();
    JButton btnReset = new JButton();
    public pnlSearch_Group(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(22, 11, 61, 37));
        txtBookName.setToolTipText("");
        txtBookName.setText("");
        txtBookName.setBounds(new Rectangle(82, 11, 98, 32));
        jLabel2.setText("作者:");
        jLabel2.setBounds(new Rectangle(211, 11, 51, 33));
        txtAuthor.setText("");
        txtAuthor.setBounds(new Rectangle(262, 11, 98, 32));
        jLabel3.setText("出版社:");
        jLabel3.setBounds(new Rectangle(21, 59, 52, 35));
        txtPublish.setText("");
        txtPublish.setBounds(new Rectangle(82, 56, 98, 32));
        btnSearch.setBounds(new Rectangle(79, 103, 79, 40));
        btnSearch.setText("查询");
        btnSearch.addActionListener(new pnlSearch_Group_btnSearch_actionAdapter(this));
        btnReset.setBounds(new Rectangle(201, 103, 79, 40));
        btnReset.setText("重置");
        btnReset.addActionListener(new pnlSearch_Group_btnReset_actionAdapter(this));
        this.add(jLabel1);
        this.add(txtBookName);
        this.add(txtAuthor);
        this.add(jLabel3);
        this.add(txtPublish);
        this.add(jLabel2);
        this.add(btnSearch);
        this.add(btnReset);
    }

    public void btnReset_actionPerformed(ActionEvent e) {
        txtBookName.setText("");
        txtAuthor.setText("");
        txtPublish.setText("");
    }

    public void btnSearch_actionPerformed(ActionEvent e) {
        ResultSet temprs;
        temprs=bookadd_condb.SearchToModify(txtBookName.getText(),txtAuthor.getText(),txtPublish.getText());
        bookadd_condb.initInfo(fm.tblData,temprs);
        fm.page=0;
        fm.DataPane(temprs);
        /*JPanel p=new JPanel();
        p.add(fm.jTableHeader1);
        p.add(fm.tblData);
        fm.spnV.setBottomComponent(p);
        */
    }
}


class pnlSearch_Group_btnSearch_actionAdapter implements ActionListener {
    private pnlSearch_Group adaptee;
    pnlSearch_Group_btnSearch_actionAdapter(pnlSearch_Group adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.btnSearch_actionPerformed(e);
    }
}


class pnlSearch_Group_btnReset_actionAdapter implements ActionListener {
    private pnlSearch_Group adaptee;
    pnlSearch_Group_btnReset_actionAdapter(pnlSearch_Group adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.btnReset_actionPerformed(e);
    }
}

⌨️ 快捷键说明

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