欢迎来到天天文库
浏览记录
ID:6300412
大小:163.41 KB
页数:24页
时间:2018-01-09
《学生管理系统代码》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
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;importjavax.s
2、wing.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;importjava.sql.ResultSet
3、;importjava.sql.Statement;importjavax.swing.JOptionPane;classLoginCheck{privateStringuser;privateStringpassWord;publicLoginCheck(Stringuser,StringpassWord){this.user=user;this.passWord=passWord;}publicbooleancheck(){if("zhouzhiqiang".equals(user)&&"123456".equals(p
4、assWord)){returntrue;}else{returnfalse;}}}classActionHandle1{privateJFrameframe=newJFrame("登录界面");privateJButtonsubmit=newJButton("登录");privateJButtonexit=newJButton("退出");privateJLabeluser=newJLabel("用户名:");privateJLabelpassWord=newJLabel("密码:");privateJLabelinfo=
5、newJLabel("学生管理系统");privateJTextFielduserText=newJTextField();privateJPasswordFieldpassText=newJPasswordField();publicActionHandle1(){Fontfnt=newFont("Serief",Font.BOLD,20);info.setFont(fnt);submit.addActionListener(newActionListener(){publicvoidactionPerformed(Act
6、ionEventarg0){if(arg0.getSource()==submit){Stringuser=userText.getText();Stringpassword=newString(passText.getPassword());LoginChecklog=newLoginCheck(user,password);if(log.check()){newActionHandle2().setMenuBar();}else{JOptionPane.showMessageDialog(null,"输入的用户名或密码有
7、误!","警告",JOptionPane.WARNING_MESSAGE);userText.setText("");passText.setText("");}}}});exit.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventarg0){if(arg0.getSource()==exit){System.exit(1);}}});frame.addWindowListener(newWindowAdapter(){pub
8、licvoidwindowClosing(WindowEventarg0){frame.dispose();}});frame.setLayout(null);user.setBounds(45,45,60,20);passWord.setBounds(45,75,60,20);info.
此文档下载收益归作者所有