练习---登陆界面
2015-03-25 09:03
190 查看
package Service;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Service extends JFrame {
public static void main(String[] args) {
// TODO Auto-generated method stub
Service s1 = new Service();
s1.show();
}
Service()
{
this.setSize(300,200);
this.setLocation(150,250);
Container con = this.getContentPane();
con.setLayout( new GridLayout(2,1));
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout());
con.add(p1);
JPanel p2 = new JPanel();
con.add(p2);
JLabel label1 = new JLabel("用户名:");
JTextField textField1 = new JTextField(20);
JLabel label2 = new JLabel("密 码:");
JTextField textField2 = new JTextField(20);
p1.add(label1);
p1.add(textField1);
p1.add(label2);
p1.add(textField2);
JButton button1 = new JButton("OK");
JButton button2 = new JButton("Cancle");
p2.add(button1);
p2.add(button2);
}
}
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Service extends JFrame {
public static void main(String[] args) {
// TODO Auto-generated method stub
Service s1 = new Service();
s1.show();
}
Service()
{
this.setSize(300,200);
this.setLocation(150,250);
Container con = this.getContentPane();
con.setLayout( new GridLayout(2,1));
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout());
con.add(p1);
JPanel p2 = new JPanel();
con.add(p2);
JLabel label1 = new JLabel("用户名:");
JTextField textField1 = new JTextField(20);
JLabel label2 = new JLabel("密 码:");
JTextField textField2 = new JTextField(20);
p1.add(label1);
p1.add(textField1);
p1.add(label2);
p1.add(textField2);
JButton button1 = new JButton("OK");
JButton button2 = new JButton("Cancle");
p2.add(button1);
p2.add(button2);
}
}
相关文章推荐
- 安卓UI练习(一)--登陆界面和逻辑代码
- Qt 数据库登陆界面练习
- Qt 数据库、登陆界面练习代码
- UI小练习,模仿登陆界面
- 4000 HTML练习制作邮箱登陆界面
- Android UI 设计 练习1 ——登陆界面
- Android复习练习四(QQ登陆界面回显用户名密码,使用/data/data/包名/路径 )
- 2013-8-12练习[制作一个具有UIAlertView和UIActionSheet的登陆界面]
- 2013-8-12练习[制作一个具有UIAlertView和UIActionSheet的登陆界面]
- java学习笔记之使用MyEclipse写一个简单的登陆界面(二)
- JSP 设计教师与学生不同登陆界面(带验证码)
- GuideMap 登陆界面 详细文档(二)
- 一个登陆界面
- react项目实战(权限模块开发三) 登陆界面开发
- IOS学习记录之登陆界面各功能的实现
- 用WPF写一个登录界面,我想在输入完密码后按回车就能够验证登陆,而不需要用鼠标单击登陆按钮
- Qt 之 模仿 QQ登陆界面——旋转窗口篇
- Android-登陆界面,包含记住密码和自动登陆
- 同用的网站登陆界面
- 详解微信小程序文本框(label/input)、按钮(button)用法,以登陆界面为例