import java.awt.BorderLayout;
import java.awt.Button;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
public class kiujh extends JFrame{
/**
* @param args
*/
public kiujh(String title) throws Exception{
super(title);
//设置基本设置
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
this.setSize(300, 150);
this.setLocation(300, 200);
this.setLayout(new BorderLayout());
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//设置用户名和密码框
JPanel jp1=new JPanel();
JTextField jt=new JTextField("Please enter the User's name");
JPasswordField pa=new JPasswordField("Please enter the Password");
jp1.setLayout(new BorderLayout());
jp1.add(jt, BorderLayout.NORTH);
jp1.add(pa, BorderLayout.SOUTH);
//设置登录按钮
JPanel jp2=new JPanel();
Button bt1=new Button("登录");
Button bt2=new Button("退出");
jp2.setLayout(new BorderLayout());
jp2.add(bt1, BorderLayout.WEST);
jp2.add(bt2, BorderLayout.EAST);
//设置标题
JLabel jl=new JLabel("登录界面");
//添加到界面里
this.add(jl, BorderLayout.NORTH);
this.add(jp1, BorderLayout.CENTER);
this.add(jp2,BorderLayout.SOUTH);
}
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
kiujh j=new kiujh("登录");
}
}