首 页 行业资讯 新车 试驾评测 养车用车 车型库

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

发布网友 发布时间:2022-04-22 22:52

我来回答

1个回答

热心网友 时间:2023-07-11 08:48

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();
}

}

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com