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

📄 go.java

📁 实现用户得登陆可以通过登陆实现增加删除和查找等得功能
💻 JAVA
字号:
package java_教务管理系统;

import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.event.*;
import java.sql.*;
import java_教务管理系统.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2008</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class go extends JDialog {
    JPanel panel1 = new JPanel();
    JTextField txtid = new JTextField();
    JPasswordField pwdmima = new JPasswordField();
    JButton btngo = new JButton();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JButton btnexit = new JButton();
    JButton btngoupdate = new JButton();
    JButton jButton1 = new JButton();
    public go(Frame owner, String title, boolean modal) {
        super(owner, title, modal);
        try {
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            jbInit();
            this.setResizable(false);
            pack();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    public go() {
        this(new Frame(), "go", false);
    }

    private void jbInit() throws Exception {
        panel1.setLayout(null);
        txtid.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        txtid.setBounds(new Rectangle(115, 20, 146, 29));
        pwdmima.setFont(new java.awt.Font("Dialog", Font.PLAIN, 20));
        pwdmima.setBounds(new Rectangle(115, 57, 146, 29));
        btngo.setBounds(new Rectangle(28, 98, 105, 30));
        btngo.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        btngo.setText("登陆");
        btngo.addActionListener(new go_btngo_actionAdapter(this));
        jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel1.setText("用户名:");
        jLabel1.setBounds(new Rectangle(24, 20, 87, 33));
        jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel2.setText("密  码:");
        jLabel2.setBounds(new Rectangle(23, 55, 90, 32));
        btnexit.setBounds(new Rectangle(192, 95, 105, 30));
        btnexit.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        btnexit.setText("退出");
        btnexit.addActionListener(new go_btnexit_actionAdapter(this));
        btngoupdate.setBounds(new Rectangle(263, 60, 56, 26));
        btngoupdate.setFont(new java.awt.Font("宋体", Font.PLAIN, 10));
        btngoupdate.setText("修改");
        btngoupdate.addActionListener(new go_btngoupdate_actionAdapter(this));
        jButton1.setBounds(new Rectangle(263, 24, 56, 26));
        jButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 10));
        jButton1.setText("注册");
        jButton1.addActionListener(new go_jButton1_actionAdapter(this));
        panel1.add(pwdmima);
        panel1.add(jLabel1);
        panel1.add(jLabel2);
        panel1.add(txtid);
        panel1.add(jButton1);
        panel1.add(btngoupdate);
        panel1.add(btnexit);
        panel1.add(btngo);
        this.getContentPane().add(panel1, java.awt.BorderLayout.CENTER);
    }

    public void btngo_actionPerformed(ActionEvent e) {
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection nod = DriverManager.getConnection("jdbc:odbc:studer");
            PreparedStatement sql = nod.prepareStatement(
                    "select useid,mima from go where useid = ? and mima = ?");
            sql.setString(1, this.txtid.getText());
            sql.setString(2, String.valueOf(this.pwdmima.getPassword()));
            ResultSet i = sql.executeQuery();
            if (i.next()) {
                TimeFrame1 obj = new TimeFrame1();
                this.dispose();
            } else {
                JOptionPane.showMessageDialog(this, "用户名密码错误");
                this.txtid.setText("");
                this.pwdmima.setText("");
            }
        } catch (Exception ex) {
        }
    }

    public void jButton1_actionPerformed(ActionEvent e) {
        goadd obj = new goadd();
        obj.setSize(300, 300);
        obj.setLocation(200, 200);
        obj.setModal(true);
        obj.setVisible(true);
    }

    public void btngoupdate_actionPerformed(ActionEvent e) {
        goupdate obj = new goupdate();
        obj.setSize(180, 180);
        obj.setLocation(200, 200);
        obj.setModal(true);
        obj.setVisible(true);
    }

    public void btnexit_actionPerformed(ActionEvent e) {
        this.txtid.setText("");
        this.pwdmima.setText("");
        this.dispose();
    }
}


class go_btnexit_actionAdapter implements ActionListener {
    private go adaptee;
    go_btnexit_actionAdapter(go adaptee) {
        this.adaptee = adaptee;
    }

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


class go_btngoupdate_actionAdapter implements ActionListener {
    private go adaptee;
    go_btngoupdate_actionAdapter(go adaptee) {
        this.adaptee = adaptee;
    }

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


class go_jButton1_actionAdapter implements ActionListener {
    private go adaptee;
    go_jButton1_actionAdapter(go adaptee) {
        this.adaptee = adaptee;
    }

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


class go_btngo_actionAdapter implements ActionListener {
    private go adaptee;
    go_btngo_actionAdapter(go adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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