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

📄 pnlbookmanage_add.java~2~

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


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;

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(61, 60, 100, 28));

        jLabel6.setText("入库日期:");
        jLabel6.setBounds(new Rectangle(177, 59, 65, 31));
        txtAddDate.setText("");
        txtAddDate.setBounds(new Rectangle(245, 59, 100, 28));
        jLabel7.setText("是否在库:");
        jLabel7.setBounds(new Rectangle(364, 56, 57, 35));
        txtIsExist.setText("");
        txtIsExist.setBounds(new Rectangle(416, 57, 100, 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));

        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(txtPublish);
        this.add(jLabel6);
        this.add(jLabel7);
        this.add(txtIsExist);
        this.add(btnAdd);
        this.add(btnReset);
        this.add(txtAddDate);
    }

    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();
    JTextField txtAddDate = new JTextField();
    JLabel jLabel7 = new JLabel();
    JTextField txtIsExist = new JTextField();
    JButton btnAdd = new JButton();
    JButton btnReset = new JButton();


    public void btnReset_actionPerformed(ActionEvent e) {
        txtNumber.setText("");
        txtName.setText("");
        txtAuthor.setText("");
        txtPrice.setText("");
        txtPublish.setText("");
        txtAddDate.setText("");
        txtIsExist.setText("");
    }

    public void btnAdd_actionPerformed(ActionEvent e) {
        bookadd_condb bc=new bookadd_condb();
       bc.BookAdd(txtNumber.getText(),txtName.getText(),txtAuthor.getText(),Integer.parseInt(txtPrice.getText()),txtPublish.getText(),txtAddDate.getText(),Integer.parseInt(txtIsExist.getText()));

       bookadd_condb.initSearch();
       bookadd_condb.initInfo(fm.tblData,bookadd_condb.rs);
       JScrollPane ps=new JScrollPane();
       JPanel p=new JPanel();
       ps.add(p);
       p.add(fm.jTableHeader1);
       p.add(fm.tblData);
       fm.spnV.setBottomComponent(p);
    }


}


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 + -