资源描述:
《Java学生课程设计源码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、packagecom.lb.view;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassLoginextendsJFrame{privateTextFieldf1;privateTextFieldf2;privateJButtonb1;privateJButtonb2;privateJButtonb3;//登陆界面publicLogin(){Containercp=getContentPane();//容器cp.setBackground(Color.cyan);cp.s
2、etLayout(newGridLayout(4,1));//四行一列布局Panelp1=newPanel();Panelp2=newPanel();Panelp3=newPanel();Panelp4=newPanel();f1=newTextField(15);f2=newTextField(15);f2.setEchoChar('*');//回显字符为*b1=newJButton("登录");b2=newJButton("重置");b3=newJButton("退出");p1.add(newLabel(""));p2.add(newLabel("用户名")
3、);p2.add(f1);p3.add(newLabel("密码"));p3.add(f2);p4.add(b1);p4.add(b2);p4.add(b3);cp.add(p1);cp.add(p2);cp.add(p3);cp.add(p4);b1.addActionListener(newEnter());b2.addActionListener(newReWrite());b3.addActionListener(newClose());}classEnterimplementsActionListener{publicvoidactionPerform
4、ed(ActionEvente){if((f1.getText()).equals("任艳云")&&(f2.getText()).equals("ren12")){XueShengframe1=newXueSheng();frame1.setBounds(200,200,400,400);frame1.setVisible(true);}elseJOptionPane.showMessageDialog(null,"用户名或密码错误,请重新登录!");}}classReWriteimplementsActionListener{publicvoidactionP
5、erformed(ActionEvente){f1.setText("");f2.setText("");f1.requestFocus();}}classCloseimplementsActionListener{publicvoidactionPerformed(ActionEvente){JButtonbt=(JButton)e.getSource();if(bt==b3){System.exit(0);}}}//主函数程序开始publicstaticvoidmain(String[]args){Loginlog=newLogin();log.setTit
6、le("系统登录");log.setBounds(200,200,300,300);log.setBackground(Color.red);log.setVisible(true);}//信息管理界面内部类进行初始化和保存classXueShengextendsJFrameimplementsActionListener{privateJButtoncx,zj,tc,sc,xg,tj;publicXueSheng(){Containerc=this.getContentPane();c.setLayout(newGridLayout(4,1));c.setBa
7、ckground(Color.cyan);c.setFont(newFont("true",Font.TRUETYPE_FONT,13));JPanelpanel1=newJPanel();panel1.setBackground(Color.cyan);JLabellabel1=newJLabel("欢迎登入成绩管理主页",SwingConstants.CENTER);label1.setFont(newFont("true",Font.TRUETYPE_FONT,15));panel1.add(label1);JPanelpanel2=newJPanel()
8、;panel2.setB