资源描述:
《JAVA语言登陆界面设计.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、登陆界面设计程序:importjavax.swing.*;importjava.awt.*;publicclass登陆界面设计extendsJFrame{public登陆界面设计(){//构造方法名称要与类名称一致this.setTitle("学生系统登陆界面");this.setForeground(Color.blue);this.setBounds(200,200,400,400);this.setDefaultCloseOperation(EXIT_ON_CLOSE);JLabellabname=newJLabel("登
2、陆名:");JLabellabpassed=newJLabel("登陆密码:");JTextFieldtex1=newJTextField("");JTextFieldtex2=newJTextField("");JButtonbun1=newJButton("登陆");JButtonbun2=newJButton("退出");JPanelpanel=(JPanel)this.getContentPane();panel.setLayout(null);panel.setBackground(Color.green);panel
3、.add(labname);labname.setBounds(100,60,100,30);//labname.setForeground(Color.red);labname.setFont(newFont(null,Font.ITALIC,20));panel.add(tex1);tex1.setBounds(200,60,100,30);//tex1.setForeground(Color.red);tex1.setFont(newFont(null,Font.ITALIC,20));panel.add(labpasse
4、d);labpassed.setBounds(100,120,100,30);//labpassed.setForeground(Color.red);labpassed.setFont(newFont(null,Font.ITALIC,20));panel.add(tex2);tex2.setBounds(200,120,100,30);//tex2.setForeground(Color.red);tex2.setFont(newFont(null,Font.ITALIC,20));panel.add(bun1);bun1.
5、setBounds(100,180,100,50);bun1.setForeground(Color.red);bun1.setFont(newFont(null,Font.ITALIC,20));panel.add(bun2);bun2.setBounds(210,180,100,50);bun2.setForeground(Color.red);bun2.setFont(newFont(null,Font.ITALIC,20));this.setVisible(true);}publicstaticvoidmain(Stri
6、ng[]args){new登陆界面设计();}}运行效果图: