求QQ登陆界面的Java GUI(图形用户界面开发)代码!

我请说下,求QQ登陆界面的Java GUI(图形用户界面开发)代码!
最新回答
感情终究破碎

2024-10-13 10:00:36

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class Demo extends JFrame{

Container contentPane;
ImageIcon img = new ImageIcon("002.jpg");

JPanel paneTop = new JPanel();
JPanel paneMid = new JPanel();
JPanel paneBut = new JPanel();
JPanel paneAll = new JPanel();

JLabel lblTop = new JLabel();
JLabel lblName = new JLabel();
JLabel lblPwd = new JLabel();
JLabel lblApply = new JLabel();
JLabel lblForget = new JLabel();
JLabel lblModel = new JLabel();
JLabel lblNull = new JLabel();

JTextField txtName = new JTextField(15);
JPasswordField txtPwd = new JPasswordField(15);

JComboBox cmb = new JComboBox();

JCheckBox chk = new JCheckBox();

JButton btnKill = new JButton("查杀木马");
JButton btnSet = new JButton("设置");
JButton btnLogin = new JButton("登录");

Demo(){
lblTop.setIcon(img);
paneTop.add(lblTop);

lblName.setText("QQ帐号:");
lblApply.setText("申请帐号 ");
lblPwd.setText("QQ密码:");
lblForget.setText("忘记密码?");
lblModel.setText("状态:");

String[] s1 = {"隐身","在线","忙碌"};
cmb.addItem(s1[0]);
cmb.addItem(s1[1]);
cmb.addItem(s1[2]);

chk.setText("自动登录");

paneMid.add(lblName);
paneMid.add(txtName);
paneMid.add(lblApply);

paneMid.add(lblPwd);
paneMid.add(txtPwd);
paneMid.add(lblForget);

paneMid.add(lblModel);
paneMid.add(cmb);
paneMid.add(chk);

paneBut.add(btnKill);
paneBut.add(btnSet);
paneBut.add(btnLogin);

contentPane = this.getContentPane();

contentPane.add(paneTop,BorderLayout.NORTH);
contentPane.add(paneMid,BorderLayout.CENTER);
contentPane.add(paneBut,BorderLayout.SOUTH);

setTitle("欢迎使用QQ");
setSize(330,240);
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((screen.width - getSize().width)/2,(screen.height - getSize().height)/2 );
setVisible(true);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public static void main(String args[]){
Demo d = new Demo();
}

}