java写一个qq登录窗口(java编写的QQ之登录窗口)
效果图
package login;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Reg extends JFrame {
private JLabel[] jl = {
new JLabel(" 用户名:"),
new JLabel(" 密 码:"),
new JLabel("确认密码:"),
new JLabel("真实姓名:"),
new JLabel(" email:"),
new JLabel(" QQ:"),
new JLabel("")
};
private JTextField[] jtf={
new JTextField(20),
new JTextField(20),
new JTextField(20),
new JTextField(20),
new JTextField(20),
new JTextField(20),
new JTextField(20)
};
private JButton[] jb={
new JButton("注册"),
new JButton("重置")
};
private JPanel jp;
public Reg() {
super("注册");
jp=new JPanel();
jp.setLayout(null);
for(int i=0;i<7;i ){
jl[i].setBounds(30,10 i*50,80,30);
jp.add(jl[i]);
}
for(int i=0;i<7;i ){
jtf[i].setBounds(120,10 i*50,180,30);
jp.add(jtf[i]);
}
for(int i=0;i<2;i ){
jb[i].setBounds(80 i*100,370,80,30);
jp.add(jb[i]);
}
this.add(jp);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int centerX = screenSize.width / 2;
int centerY = screenSize.height / 2;
this.setBounds(centerX - 175, centerY - 350, 350, 450);
this.setVisible(true);
this.setResizable(false);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public static void main(String args[]) {
new Reg();
}
}
,免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com