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

📄 mzxxadd.java~7~

📁 这是一个图书和学生信息的管理系统,它可以在数据库里面增加,修改,删除数据来管理图书和学生信息
💻 JAVA~7~
字号:
package xswbsix;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */import com.zdsoft.gui.*;import java.awt.*;import javax.swing.*;import java.awt.event.*;import com.zdsoft.datacenter.ASDatacenter;public class mzxxAdd extends ASDialog{  BorderLayout borderLayout1 = new BorderLayout();  JPanel jPanel1 = new JPanel();  JPanel jPanel2 = new JPanel();  JPanel jPanel3 = new JPanel();  JLabel jLabel1 = new JLabel();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  GridBagLayout gridBagLayout1 = new GridBagLayout();  JLabel jLabel2 = new JLabel();  JTextField mzdm = new JTextField();  JLabel jLabel3 = new JLabel();  JTextField mzmc = new JTextField();  mzdmShow mzshow;  public mzxxAdd(mzdmShow mzshowaaa) {    mzshow = mzshowaaa;    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  private void jbInit() throws Exception {    this.setSize(new Dimension(277, 154));    this.getContentPane().setLayout(borderLayout1);    jLabel1.setText("增加民族信息");    jButton1.setText("取消");    jButton1.addActionListener(new mzxxAdd_jButton1_actionAdapter(this));    jButton2.setText("确定");    jButton2.addActionListener(new mzxxAdd_jButton2_actionAdapter(this));    jPanel1.setLayout(gridBagLayout1);    jLabel2.setText("民族代码:");    mzdm.setPreferredSize(new Dimension(100, 22));    mzdm.setText("");    jLabel3.setText("民族名称:");    mzmc.setPreferredSize(new Dimension(100, 22));    mzmc.setText("");    this.getContentPane().add(jPanel1, BorderLayout.CENTER);    jPanel1.add(jLabel2,  new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    jPanel1.add(mzdm,  new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    jPanel1.add(jLabel3, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    jPanel1.add(mzmc, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    this.getContentPane().add(jPanel2, BorderLayout.SOUTH);    jPanel2.add(jButton2, null);    jPanel2.add(jButton1, null);    this.getContentPane().add(jPanel3, BorderLayout.NORTH);    jPanel3.add(jLabel1, null);    this.setWindowCenter();  }  void jButton1_actionPerformed(ActionEvent e) {    this.dispose();  }  void jButton2_actionPerformed(ActionEvent e) {    ASDatacenter dc = new ASDatacenter();    dc.connect();    String sql = "insert into mz_dm(mz_id,mz_name) values("+        mzdm.getText()+",'"+mzmc.getText()+"')";    String[] msg = dc.update(sql);    if(msg[0].equals("true")){      int row = mzshow.ds.addRow();      try {        mzshow.ds.setObjectAt(row,"mz_id",new Integer(mzdm.getText()));        mzshow.ds.setObjectAt(row,"mz_name",mzmc.getText());        mzshow.jTable1.ASTableRepant();      }      catch (Exception ex) {        ex.printStackTrace();      }      this.dispose();    }    else{      JOptionPane.showMessageDialog(this,"保存失败!","信息提示",                                    JOptionPane.ERROR_MESSAGE);      this.dispose();    }    dc.disconnect();  }}class mzxxAdd_jButton1_actionAdapter implements java.awt.event.ActionListener {  mzxxAdd adaptee;  mzxxAdd_jButton1_actionAdapter(mzxxAdd adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}class mzxxAdd_jButton2_actionAdapter implements java.awt.event.ActionListener {  mzxxAdd adaptee;  mzxxAdd_jButton2_actionAdapter(mzxxAdd adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton2_actionPerformed(e);  }}

⌨️ 快捷键说明

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