package com.SwingIn51; import java.awt.*; import javax.swing.*; public class QQLanuch extends JFrame{ JLabel label_North;//北部 JButton button_South1,button_South2,button_South3;//南部 JPanel panel_South1; JTabbedPane tabbedPane;//中部 JPanel panel_Center2,panel_Center3,panel_Center4; JLabel label2,label3,label4,label5; JTextField textField; JPasswordField passwordField; JButton button4; JCheckBox checkBox1,checkBox2; public QQLanuch() { label2=new JLabel("QQ号码:",JLabel.CENTER); label3=new JLabel("QQ密码:",JLabel.CENTER); label4=new JLabel("忘记密码:",JLabel.CENTER); label4.setFont(new Font("宋体",Font.PLAIN,16));//设置字体 label4.setForeground(Color.BLUE);//设置字体颜色 label5=new JLabel("<html><a href='www.qq.com'>申请密码保护</a>");//设置标签链接 label5.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));//设置指针(指鼠标的)的预定义样式 textField=new JTextField(); passwordField=new JPasswordField(); button4=new JButton("清除号码"); checkBox1=new JCheckBox("隐身登录"); checkBox2=new JCheckBox("记住密码"); label_North=new JLabel(new ImageIcon("image/car.jpg"));//设置图片 panel_South1=new JPanel(); button_South1=new JButton("登录"); button_South2=new JButton("取消"); button_South3=new JButton("向导"); tabbedPane=new JTabbedPane(); panel_Center2=new JPanel(); panel_Center3=new JPanel(); panel_Center4=new JPanel(); panel_Center3.setBackground(Color .BLACK);//设置面板颜色 panel_Center4.setBackground(Color.BLUE); tabbedPane.add("普通用户", panel_Center2); tabbedPane.add("QQ会员", panel_Center3); tabbedPane.add("管理员", panel_Center4); panel_Center2.setLayout(new GridLayout(3,3));//面板2位3行3列 panel_South1.add(button_South1); panel_South1.add(button_South2); panel_South1.add(button_South3); panel_Center2.add(label2); panel_Center2.add(textField); panel_Center2.add(button4); panel_Center2.add(label3); panel_Center2.add(passwordField); panel_Center2.add(label4); panel_Center2.add(checkBox1); panel_Center2.add(checkBox2); panel_Center2.add(label5); this.add(panel_South1,BorderLayout.SOUTH);//把三个组件添加到JFame中 this.add(tabbedPane, BorderLayout.CENTER); this.add(label_North, BorderLayout.NORTH); this.setTitle("用户登录"); this.setSize(340, 270); this.setLocation(300, 280); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); ImageIcon head_Image=new ImageIcon("image/car.jpg");//设置图标 this.setIconImage(head_Image.getImage()); } public static void main(String[] args) { QQLanuch a=new QQLanuch(); } }
实现QQ登录界面
猜你喜欢
转载自blog.csdn.net/weixin_41060905/article/details/80370199
今日推荐
周排行