资源描述:
《用java编写一个用户登陆界面用户验证通过数据库实现》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、这是我以前写的系统登录框的loginpackagejava1;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjava.util.*;importjavax.swing.*;importjavax.swing.event.*;importjava.awt.Rectangle;importjava.awt.Font;publicclassloginextendsJFrame{publiclogin(){try{jbInit();}catch(Exceptionex){ex.p
2、rintStackTrace();}}publicstaticvoidmain(String[]args){loginfrm=newlogin();frm.setBounds(300,200,300,260);frm.setVisible(true);}privatevoidjbInit()throwsException{this.getContentPane().setLayout(null);jLabel1.setForeground(Color.red);jLabel1.setText("用户名");jLabel1.setBounds(newR
3、ectangle(25,72,68,29));jButton2.setBounds(newRectangle(142,159,81,30));jButton2.setText("取消");jButton2.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){jButton2_actionPerformed(e);}});jButton1.setBounds(newRectangle(38,159,81,29));jButton1.setText("
4、确定");jButton1.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){jButton1_actionPerformed(e);}});jTextField1.setBounds(newRectangle(109,79,136,23));jPasswordField1.setBounds(newRectangle(109,115,136,23));this.getContentPane().add(jLabel1);jLabel3.setF
5、ont(newjava.awt.Font("隶书",Font.PLAIN,24));jLabel3.setText("学生考试系统");jLabel3.setBounds(newRectangle(22,15,268,47));this.getContentPane().add(jTextField1);this.getContentPane().add(jLabel2);this.getContentPane().add(jButton2);this.getContentPane().add(jButton1);this.getContentPan
6、e().add(jLabel3);this.getContentPane().add(jPasswordField1);jLabel2.setForeground(Color.red);jLabel2.setText("密码");jLabel2.setBounds(newRectangle(26,112,68,29));}JLabeljLabel1=newJLabel();JLabeljLabel2=newJLabel();JTextFieldjTextField1=newJTextField();JButtonjButton1=newJButton
7、();JButtonjButton2=newJButton();JLabeljLabel3=newJLabel();JPasswordFieldjPasswordField1=newJPasswordField();main2wo=newmain2();intsum;//判断权限的方法publicvoidsuccess(){try{ResultSetrs1;Strings1="select*from管理权限wherename='"+jTextField1.getText()+"'andpassword='"+jPasswordField1.getTe
8、xt()+"'";rs1=sqlcx.Rs_jiluji(s1);rs1.first();sum=Integ