欢迎来到天天文库
浏览记录
ID:10809860
大小:163.41 KB
页数:24页
时间:2018-07-08
《学生管理系统代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、importjava.awt.*;importjavax.swing.*;importjava.awt.Font;importjavax.swing.ButtonGroup;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JRadioButton;importjavax.swing.JScrollPane;importjavax.swing.JTextArea;impo
2、rtjavax.swing.JTextField;importjavax.swing.JPasswordField;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.WindowAdapter;importjava.awt.event.WindowEvent;importjava.sql.Connection;importjava.sql.DriverManager;import
3、java.sql.ResultSet;importjava.sql.Statement;importjavax.swing.JOptionPane;classLoginCheck{privateStringuser;privateStringpassWord;publicLoginCheck(Stringuser,StringpassWord){this.user=user;this.passWord=passWord;}publicbooleancheck(){if("zhouzhiqiang".equa
4、ls(user)&&"123456".equals(passWord)){returntrue;}else{returnfalse;}}}classActionHandle1{privateJFrameframe=newJFrame("登录界面");privateJButtonsubmit=newJButton("登录");privateJButtonexit=newJButton("退出");privateJLabeluser=newJLabel("用户名:");privateJLabelpassWord
5、=newJLabel("密码:");privateJLabelinfo=newJLabel("学生管理系统");privateJTextFielduserText=newJTextField();privateJPasswordFieldpassText=newJPasswordField();publicActionHandle1(){Fontfnt=newFont("Serief",Font.BOLD,20);info.setFont(fnt);submit.addActionListener(newA
6、ctionListener(){publicvoidactionPerformed(ActionEventarg0){if(arg0.getSource()==submit){Stringuser=userText.getText();Stringpassword=newString(passText.getPassword());LoginChecklog=newLoginCheck(user,password);if(log.check()){newActionHandle2().setMenuBar(
7、);}else{JOptionPane.showMessageDialog(null,"输入的用户名或密码有误!","警告",JOptionPane.WARNING_MESSAGE);userText.setText("");passText.setText("");}}}});exit.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventarg0){if(arg0.getSource()==exit){Sys
8、tem.exit(1);}}});frame.addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEventarg0){frame.dispose();}});frame.setLayout(null);user.setBounds(45,45,60,20);passWord.setBounds(45,75,60,20);info.
此文档下载收益归作者所有