package qqchat;
import javax.swing.*;
public class qqchat1 {
JFrame frame=new JFrame();
qqchat1() {
//背景图
ImageIcon bg=new ImageIcon("src/qq.jpg");
JLabel label1=new JLabel(bg);
int width=bg.getIconWidth();
int height=bg.getIconHeight();
label1.setSize(width,height);
frame.getLayeredPane().add(label1,Integer.valueOf(Integer.MIN_VALUE));
JPanel pan_background=(JPanel)frame.getContentPane();
pan_background.setLayout(null);
pan_background.setOpaque(false);
//头像
ImageIcon pho=new ImageIcon("src/ok.png");
JLabel label2=new JLabel(pho);
label2.setSize(pho.getIconWidth(), pho.getIconHeight());
label2.setBounds(10,10,60,60);
pan_background.add(label2);
//文本框 账号
JTextField count=new JTextField("请输入账号:");
count.setBounds(75,17,100,20);
pan_background.add(count);
//文本框 密码
JPasswordField secret=new JPasswordField();
secret.setBounds(75,43,100,20);
pan_background.add(secret);
//自动登录复选框
JCheckBox alogin=new JCheckBox("自动登录");
alogin.setBounds(10,70,90,13);
pan_background.add(alogin);
JCheckBox rem=new JCheckBox("记住密码");
rem.setBounds(95,70,90,13);
pan_background.add(rem);
//注册账号,找回密码
JLabel register=new JLabel("注册账号");
register.setBounds(183, 15, 80, 20);
pan_background.add(register);
JLabel fsecret=new JLabel("找回密码");
fsecret.setBounds(183, 41, 80, 20);
pan_background.add(fsecret);
//登录按钮
JButton loginb=new JButton("登 录");
loginb.setBounds(40, 94, 60, 20);
pan_background.add(loginb);
frame.setSize(width,height);
frame.setLocationRelativeTo(null);//设置窗口位置在屏幕中央
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String[] args) {
qqchat1 q=new qqchat1();
}
}
一个简单的登录界面
最新推荐文章于 2024-09-15 19:46:31 发布