欢迎来到天天文库
浏览记录
ID:38581202
大小:68.00 KB
页数:7页
时间:2019-06-15
《java编写的学生管理》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、用户名:123,密码:abc//--------Login类登录窗体packagezhuang;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassLoginimplementsActionListener{TextFieldname;TextFieldpassword;publicFramef;publicstaticvoidmain(Stringargs[])throwsException{Loginlg=newLogin();lg.createUI();}publicvoidcreateU
2、I(){f=newFrame("登录界面");f.add(newLabel("请输入您的用户信息:"),"North");Panelp1=newPanel();p1.setLayout(newBorderLayout());Panelp11=newPanel();p11.setLayout(newGridLayout(2,1));p11.add(newLabel("用户名:"));p11.add(newLabel("密码:"));Panelp12=newPanel();p12.setLayout(newGridLayout(2,1));name=newTextField(10);na
3、me.addActionListener(this);password=newTextField(10);password.setEchoChar('*');password.addActionListener(this);p12.add(name);p12.add(password);p1.add(p11,"West");p1.add(p12,"Center");Panelp2=newPanel();Buttonsubmit=newButton("登录");Buttonreset=newButton("取消");submit.addActionListener(this);rese
4、t.addActionListener(this);p2.add(submit);p2.add(reset);f.add(p1,"Center");f.add(p2,"South");f.addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit(0);}});f.setSize(200,130);f.setLocation(300,200);f.setVisible(true);}publicvoidactionPerformed(ActionEvente){Strin
5、gs=e.getActionCommand();if(s.equals("取消"))System.exit(0);if(s.equals("登录")
6、
7、(e.getSource()==name)
8、
9、(e.getSource()==password))this.submit();}publicvoidsubmit(){Stringn=name.getText();Stringpsw=password.getText();if(n.equals("123")&&psw.equals("abc")){f.setVisible(false);try{newxitongFrame();}cat
10、ch(Exceptionex){}}7elseJOptionPane.showMessageDialog(null,"帐号或密码错误!","警告",JOptionPane.ERROR_MESSAGE);}}//------------------------------Student类,主窗体packagezhuang;importjavax.swing.*;importjava.awt.event.*;importjava.awt.*;importjava.io.*;importjava.sql.*;importzhuang.query;publicclassStudentexte
11、ndsJFrameimplementsActionListener{privateJButtonshow;privateJButtoninsert;privateJButtondelete;privateJButtonedit;privateJButtonexit;privateJButtonquery;JTabletable;Objectdata[][]=newObject[30][9];Stringtitle[]={"编号","学号","姓名","性别
此文档下载收益归作者所有