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

📄 gaoji.java

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

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.*;
import com.borland.dx.sql.dataset.*;
import com.borland.dx.dataset.*;
import java.awt.event.*;
import java.awt.Font;
import java.awt.BorderLayout;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.SQLException;
//import Frame1.class;
/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author unascribed
 * @version 1.0
 */
public class gaoji 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 jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JTextField jTextField1 = new JTextField();
  JLabel jLabel5 = new JLabel();
  JButton jButton1 = new JButton();
  JPasswordField jPasswordField1 = new JPasswordField();

  public gaoji(Frame frame, String title, boolean modal) {
    super(frame, title, modal);
    try {
      jbInit();
      pack();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  public gaoji() {
    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);
    jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
    jLabel2.setForeground(Color.red);
    jLabel2.setText("     请输入您的ID和密码");
    jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
    jLabel3.setForeground(Color.magenta);
    jLabel3.setText("ID");
    jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
    jLabel5.setForeground(Color.magenta);
    jLabel5.setText("密码");
    jButton1.setText("登陆");
    jButton1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton1_actionPerformed(e);
      }
    });

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

        abClicked(e);
      }


    }

    );
    this.getContentPane().add(jPanel1, BorderLayout.CENTER);
    jPanel1.add(jLabel1, new XYConstraints(0, 1, 399, 53));
    jPanel1.add(jLabel2, new XYConstraints(81, 73, -1, -1));
    jPanel1.add(jTextField1, new XYConstraints(77, 159, 76, -1));
    jPanel1.add(jLabel3, new XYConstraints(45, 155, -1, -1));
    jPanel1.add(jLabel5, new XYConstraints(198, 155, -1, -1));
    jPanel1.add(jButton1, new XYConstraints(164, 246, -1, -1));
    jPanel1.add(jPasswordField1, new XYConstraints(258, 158, 81, 23));
    jPanel1.add(jLabel4, new XYConstraints(14, 113, 397, 202));
  }

  void abClicked(MouseEvent e)
    {
      dabaco bb=new dabaco();
      String gg="";
      String hh="";
      boolean mk=false;
      String a=jTextField1.getText();
      String b= jPasswordField1.getText();

      try{

        String query = "select 姓名,密码 from gaoguan ";
        ResultSet rs = bb.stmt.executeQuery(query);
        ResultSetMetaData rsmd = rs.getMetaData();
        //System.out.println(rs.getString(1));


        while (rs.next()) {
           gg=rs.getString(1);
           hh=rs.getString(2);
           //System.out.println(gg);
           if(mk==true)
           {

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

           }






      }
}
        catch(SQLException ex)
        {

      }


      if(mk==true)
      {


          gaoji1 dlg = new gaoji1();
          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);
      }
      else{

        String st="           输入错误,请重新输入";
       cheng dlg = new cheng(st);
       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 cancel()
  {
    dispose() ;
  }

  public void jButton1_actionPerformed(ActionEvent e) {

  }
}


⌨️ 快捷键说明

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