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

📄 login.java~141~

📁 用java实现的学生管理系统
💻 JAVA~141~
字号:
package xscjgl;

import javax.swing.JFrame;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.JEditorPane;
import javax.swing.JComboBox;
import javax.swing.Box;
import java.awt.Component;
import javax.swing.JTextPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JTextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;
import java.sql.ResultSet;
import javax.swing.ImageIcon;
import javax.swing.JPasswordField;
import java.awt.Dimension;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dx.sql.dataset.Load;
import java.awt.Rectangle;


/**
 * <p>Title: java xscjgl</p>
 *
 * <p>Description:学生查成绩,管理员输成绩、管理。二种权限的学生成绩管理系统 </p>
 *
 * <p>Copyright: lixing (c) 2006</p>
 *
 *
 * @author 04级计算机教育班 黎兴
 * @version 1.0
 */
public class login extends JFrame {
    public login() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        glue1 = Box.createGlue();
        this.getContentPane().setLayout(paneLayout1);
        this.setForeground(Color.lightGray);
        this.setTitle("学生成绩管理系统");
        jButton2.setText("退出");
        jButton2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                jButton2_actionPerformed(e);
            }
        });
        jPasswordField1.setText("");
        jButton1.setText("登陆");

        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
                jButton1_actionPerformed(e);
            }
        });

        jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 15));
        jLabel1.setForeground(Color.blue);
        jLabel1.setText("学生成绩管理系统登陆");
        jPanel1.setBackground(new Color(241, 249, 249));
        jPanel1.setLayout(xYLayout2);
        jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jLabel2.setText("用户名:");
        jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jLabel3.setText("密  码:");
        jPanel1.add(jT_user, new XYConstraints(163, 60, 119, 26));
        jPanel1.add(jLabel2, new XYConstraints(47, 53, 79, 44));
        jPanel1.add(jLabel3, new XYConstraints(48, 103, 85, 41));
        jPanel1.add(jPasswordField1, new XYConstraints(164, 109, 117, -1));
        jPanel1.add(jButton2, new XYConstraints(258, 174, -1, -1));
        jPanel1.add(jButton1, new XYConstraints(93, 177, -1, -1));
        jPanel1.add(jLabel1, new XYConstraints(125, 3, 151, 20));

        this.getContentPane().add(jPanel1,
                                  new PaneConstraints("jPanel1", "jPanel1",
                PaneConstraints.ROOT, 0.5F));
        this.getContentPane().add(glue1,
                                  new PaneConstraints("glue1", "jPanel1",
                PaneConstraints.TOP, 0.13907284F));
    }

    Component glue1 = Box.createGlue();
    JPanel jPanel1 = new JPanel();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JTextField jT_user = new JTextField();
    JLabel jLabel3 = new JLabel();
    JButton jButton2 = new JButton();
    JPasswordField jPasswordField1 = new JPasswordField();
    JButton jButton1 = new JButton();
    DataModule1 dataModule11 = new DataModule1();
    PaneLayout paneLayout1 = new PaneLayout();
    XYLayout xYLayout2 = new XYLayout();
    public void dologin(){
        String password_text=jPasswordField1.getText().toString().trim();
        String username_text=jT_user.getText().toString().trim();
        String strSQL = "select * from UserTable where Uno='" +
                                 username_text + "'";
        try{
            Jdbcconn conn=new Jdbcconn();
            conn.OpenConn("tqti","tqti","111111");
            ResultSet rs=conn.getResults(strSQL);
            rs.first();
            int db_Right=rs.getInt("Uright");
            String db_password = rs.getString("Upwd");
            if(password_text.equals(db_password)){
                this.dispose();
                main mianFrame=new main();
                mianFrame.setVisible(true);
                mianFrame.setLocationRelativeTo(null);
                mianFrame.userNumber=username_text;
                mianFrame.passWord=password_text;
                if(db_Right==3){
                  mianFrame.jMenuItem2.setVisible(false);
                }else if(db_Right==1){
                  mianFrame.jMenuItem3.setEnabled(false);
                }
           }else{
                JOptionPane.showMessageDialog(null, "用户名或密码错误,请重新输入!");
                jPasswordField1.setText("");
                jT_user.setText("");
            }
        }catch(Exception ex){
            JOptionPane.showMessageDialog(null,"catch:用户名或密码错误,请重新输入!");
            jPasswordField1.setText("");
            jT_user.setText("");
        }//end try catch

     }//end dologin
     public static void main(String args[]){
     login Login_Frame=new login();
     Login_Frame.setVisible(true);
     Login_Frame.setLocationRelativeTo(null);
     Login_Frame.setSize(new Dimension(455,355));
     }

    public void jButton1_actionPerformed(ActionEvent e) {
        this.dologin();
    }

    public void jButton2_actionPerformed(ActionEvent e) {
        System.exit(0);
    }


}


⌨️ 快捷键说明

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