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

📄 xueshengjian.java

📁 这是自己做的图书馆信息管理系统
💻 JAVA
字号:
package infomanagement;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2003</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
import java.awt.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Font;
import com.borland.jbcl.layout.XYLayout;
import java.awt.Color;
import com.borland.dx.dataset.Column;
import javax.swing.JDialog;
import javax.swing.JTextField;
import java.awt.Frame;
import com.borland.dx.sql.dataset.Database;
import com.borland.dx.sql.dataset.QueryDataSet;
import javax.swing.JLabel;
import com.borland.jbcl.layout.XYConstraints;
import javax.swing.JButton;
import java.awt.event.MouseEvent;
import java.awt.Dimension;
import java.awt.Point;
import java.sql.PreparedStatement;
import java.sql.*;
import java.sql.SQLException;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2003</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class xueshengjian extends JDialog {
  private JPanel jPanel1 = new JPanel();
  private XYLayout xYLayout1 = new XYLayout();
  private JLabel jLabel1 = new JLabel();
  private JLabel jLabel4 = new JLabel();
  private QueryDataSet queryDataSet1 = new QueryDataSet();
  private Database database1 = new Database();
  private QueryDataSet queryDataSet2 = new QueryDataSet();
  private Column column1 = new Column();
  JLabel jLabel5 = new JLabel();
  JTextField jTextField2 = new JTextField();
  JButton jButton1 = new JButton();
  JLabel jLabel2 = new JLabel();
  public xueshengjian(Frame frame, String title, boolean modal) {
    super(frame, title, modal);
    try {
      jbInit();
      pack();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  public xueshengjian() {
    this(null, "", false);
  }
  private void jbInit() throws Exception {
    jPanel1.setLayout(xYLayout1);
    jLabel1.setFont(new java.awt.Font("Dialog", 0, 23));
    jLabel1.setForeground(Color.magenta);
    jLabel1.setBorder(BorderFactory.createEtchedBorder());
    jLabel1.setText("                      学生删除窗口");
    jLabel4.setBorder(BorderFactory.createEtchedBorder());
    database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor
                            ("jdbc:odbc:local", "sa", "", false,
                             "sun.jdbc.odbc.JdbcOdbcDriver"));
    column1.setColumnName("NewColumn1");
    column1.setDataType(com.borland.dx.dataset.Variant.STRING);
    column1.setPreferredOrdinal(0);
    column1.setServerColumnName("NewColumn1");
    column1.setSqlType(0);
    jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
    jLabel5.setForeground(Color.magenta);
    jLabel5.setText("学号");
    jButton1.setText("删除");

    jButton1.addMouseListener(new java.awt.event.MouseAdapter()
    {
      //判断输入是否正确,是就进入,否就弹出一个对话框提示错误
      public void mouseClicked(MouseEvent e)
      {
         aaClicked(e);

      }


    }

    );
    jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
    jLabel2.setForeground(Color.red);
    jLabel2.setText("请输入要删除学生的学号");
    this.getContentPane().add(jPanel1, BorderLayout.CENTER);
    jPanel1.add(jLabel1, new XYConstraints(0, 1, 399, 53));
    jPanel1.add(jButton1, new XYConstraints(165, 231, -1, -1));
    jPanel1.add(jLabel2, new XYConstraints(92, 67, -1, -1));
    jPanel1.add(jTextField2, new XYConstraints(189, 147, 90, -1));
    jPanel1.add(jLabel4, new XYConstraints(2, 96, 397, 202));
    jPanel1.add(jLabel5, new XYConstraints(114, 144, -1, -1));
  }
  void abClicked(MouseEvent e)
  {



      putong1 dlg=new putong1();
      Dimension dlgSize = dlg.getPreferredSize();
      Dimension frmSize = getSize();
      Point loc = getLocation();
      dlg.setLocation((frmSize.width - dlgSize.width) / 2 +
                      loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
      dlg.setModal(true);
      dlg.pack();

      dlg.setVisible(true);

  }
  void aaClicked(MouseEvent e)
  {
    String a=jTextField2.getText();
    String query="delete from student where 学号="+"'"+a+"'";
    try
      {
      dabaco bb=new dabaco();
      Statement ps=bb.conn.createStatement();

      String gg;
      boolean mk=false;
      String query1="select 学号 from student";
      ResultSet ff=bb.stmt.executeQuery(query1);
      while(ff.next())
      {
        gg=ff.getString(1);
       if(mk==true)
       {

       }
       else if(gg.equals(a)&& mk==false)
       {
        mk=true;
       }
       else
       {

       }

    }
    if(mk==true)
    { if(a!="")
      {
       ResultSet rs=ps.executeQuery(query);
      }
    }
    else
    {

      my dlg = new my();
      Dimension dlgSize = dlg.getPreferredSize();
      Dimension frmSize = getSize();
      Point loc = getLocation();
      dlg.setLocation( (frmSize.width - dlgSize.width) / 2 +
               loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
      dlg.setModal(true);
      dlg.pack();

      dlg.setVisible(true);
      }}
      catch(SQLException ex)
      {

      }


  }

  void cancel(){
    dispose() ;
  }



}

⌨️ 快捷键说明

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