/**
* 功能:QQ客户端登陆界面
*/
package com.qq.client.view;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.ObjectOutputStream;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.UIManager;
import com.qq.client.model.QqClientUser;
import com.qq.client.tools.ManageClientConServerThread;
import com.qq.client.tools.ManageQqFriendList;
import com.qq.common.Message;
import com.qq.common.MessageType;
import com.qq.common.User;
public class QqClientLogin extends JFrame implements ActionListener{
//定义北部需要的组件
JLabel jbl1;
//定义中部需要的组件
//中部有三个JPanel,有一个叫选项卡窗口管理
JTabbedPane jtp;
JPanel jp2,jp3,jp4;
JLabel jp2_jbl1,jp2_jbl2,jp2_jbl3,jp2_jbl4;
JButton jp2_jb1;
JTextField jp2_jtf;
JPasswordField jp2_jpf;
JCheckBox jp2_jcb1,jp2_jcb2;
//定义南部需要的组件
JPanel jp1;
JButton jp1_jb1,jp1_jb2,jp1_jb3;
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
new QqClientLogin();
}
public void initNorthLayout(){
//处理北部
jbl1=new JLabel(new ImageIcon("image/qqview.jpg"));
}
public void initCenterLayout(){
//处理中部
jp2=new JPanel();
jp2.setLayout(null);
jp2_jbl1=new JLabel("QQ号码:");
jp2_jbl1.setBounds(30, 15, 60, 25);
jp2_jbl2=new JLabel("QQ密码:");
jp2_jbl2.setBounds(30, 50, 60, 25);
jp2_jbl3=new JLabel("忘记密码");
jp2_jbl3.setForeground(Color.blue);
jp2_jbl3.setBounds(260, 50, 80, 25);
jp2_jbl3.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jp2_jbl4=new JLabel("申请密码保护");
jp2_jbl4.setForeground(Color.blue);
jp2_jbl4.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jp2_jbl4.setBounds(250, 85, 100, 25);
jp2_jb1=new JButton("清除号码");
jp2_jb1.setBounds(245, 15, 80, 25);
jp2_jtf=new JTextField();
jp2_jtf.setBounds(80, 15, 150, 25);
jp2_jpf=new JPasswordField();
jp2_jpf.setBounds(80, 50, 150, 25);
jp2_jcb1=new JCheckBox("隐身登录");
jp2_jcb1.setBounds(75, 85, 80, 25);
jp2_jcb2=new JCheckBox("记住密码");
jp2_jcb2.setBounds(155, 85, 80, 25);
//把控制按顺序加入jp2
jp2.add(jp2_jbl1);
jp2.add(jp2_jtf);
jp2.add(jp2_jb1);
jp2.add(jp2_jbl2);
jp2.add(jp2_jpf);
jp2.add(jp2_jbl3);
jp2.add(jp2_jcb1);
jp2.add(jp2_jcb2);
jp2.add(jp2_jbl4);
//jp3,jp4
jp3=new JPanel();
jp4=new JPanel();
//创建选项卡窗口
jtp=new JTabbedPane();
jtp.add(jp2,"QQ号码");
jtp.add(jp3,"手机号码");
jtp.add(jp4,"电子邮件");
}
public void initSouthLayout(){
//处理南部
jp1=new JPanel();
jp1_jb1=new JButton("登录");
jp1_jb1.addActionListener(this);
jp1_jb2=new JButton("取消");
jp1_jb2.addActionListener(this);
jp1_jb3=new JButton("注册");
//把三个按钮放到jp1
jp1.add(jp1_jb1);
jp1.add(jp1_jb2);
jp1.add(jp1_jb3);
}
//构造函数
public QqClientLogin(){
//布局北部
this.initNorthLayout();
//布局中部
this.initCenterLayout();
//布局南部
this.initSouthLayout();
this.add(jbl1,"North");
this.add(jtp,"Center");
this.add(jp1,"South");
this.setTitle("QQ登录界面");
this.setResizable(false);
this.setSize(350, 300);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
1/**
2* 功能:QQ客户端登陆界面
3*/
4package com.qq.client.view;
5
6import java.awt.Color;
7import java.awt.Cursor;
8import java.awt.FlowLayout;
9import java.awt.GridLayout;
10import java.awt.event.ActionEvent;
11import java.awt.event.ActionListener;
12import java.io.IOException;
13import java.io.ObjectOutputStream;
14import javax.swing.ImageIcon;
15import javax.swing.JButton;
16import javax.swing.JCheckBox;
17import javax.swing.JFrame;
18import javax.swing.JLabel;
19import javax.swing.JOptionPane;
20import javax.swing.JPanel;
21import javax.swing.JPasswordField;
22import javax.swing.JTabbedPane;
23import javax.swing.JTextField;
24import javax.swing.UIManager;
25import com.qq.client.model.QqClientUser;
26import com.qq.client.tools.ManageClientConServerThread;
27import com.qq.client.tools.ManageQqFriendList;
28import com.qq.common.Message;
29import com.qq.common.MessageType;
30import com.qq.common.User;
31
32public class QqClientLogin extends JFrame implements ActionListener{
33//定义北部需要的组件
34JLabel jbl1;
35//定义中部需要的组件
36//中部有三个JPanel,有一个叫选项卡窗口管理
37JTabbedPane jtp;
38JPanel jp2,jp3,jp4;
39JLabel jp2_jbl1,jp2_jbl2,jp2_jbl3,jp2_jbl4;
40JButton jp2_jb1;
41JTextField jp2_jtf;
42JPasswordField jp2_jpf;
43JCheckBox jp2_jcb1,jp2_jcb2;
44
45//定义南部需要的组件
46JPanel jp1;
47JButton jp1_jb1,jp1_jb2,jp1_jb3;
48public static void main(String[] args) {
49try {
50UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
51} catch (Exception e) {
52e.printStackTrace();
53}
54new QqClientLogin();
55}
56
57public void initNorthLayout(){
58//处理北部
59jbl1=new JLabel(new ImageIcon("image/qqview.jpg"));
60}
61
62public void initCenterLayout(){
63//处理中部
64jp2=new JPanel();
65jp2.setLayout(null);
66jp2_jbl1=new JLabel("QQ号码:");
67jp2_jbl1.setBounds(30, 15, 60, 25);
68jp2_jbl2=new JLabel("QQ密码:");
69jp2_jbl2.setBounds(30, 50, 60, 25);
70jp2_jbl3=new JLabel("忘记密码");
71jp2_jbl3.setForeground(Color.blue);
72jp2_jbl3.setBounds(260, 50, 80, 25);
73jp2_jbl3.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
74jp2_jbl4=new JLabel("申请密码保护");
75jp2_jbl4.setForeground(Color.blue);
76jp2_jbl4.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
77jp2_jbl4.setBounds(250, 85, 100, 25);
78jp2_jb1=new JButton("清除号码");
79jp2_jb1.setBounds(245, 15, 80, 25);
80jp2_jtf=new JTextField();
81jp2_jtf.setBounds(80, 15, 150, 25);
82jp2_jpf=new JPasswordField();
83jp2_jpf.setBounds(80, 50, 150, 25);
84jp2_jcb1=new JCheckBox("隐身登录");
85jp2_jcb1.setBounds(75, 85, 80, 25);
86jp2_jcb2=new JCheckBox("记住密码");
87jp2_jcb2.setBounds(155, 85, 80, 25);
88//把控制按顺序加入jp2
89jp2.add(jp2_jbl1);
90jp2.add(jp2_jtf);
91jp2.add(jp2_jb1);
92jp2.add(jp2_jbl2);
93jp2.add(jp2_jpf);
94jp2.add(jp2_jbl3);
95jp2.add(jp2_jcb1);
96jp2.add(jp2_jcb2);
97jp2.add(jp2_jbl4);
98
99//jp3,jp4
100jp3=new JPanel();
101jp4=new JPanel();
102
103//创建选项卡窗口
104jtp=new JTabbedPane();
105jtp.add(jp2,"QQ号码");
106jtp.add(jp3,"手机号码");
107jtp.add(jp4,"电子邮件");
108}
109
110public void initSouthLayout(){
111//处理南部
112jp1=new JPanel();
113jp1_jb1=new JButton("登录");
114jp1_jb1.addActionListener(this);
115jp1_jb2=new JButton("取消");
116jp1_jb2.addActionListener(this);
117jp1_jb3=new JButton("注册");
118//把三个按钮放到jp1
119jp1.add(jp1_jb1);
120jp1.add(jp1_jb2);
121jp1.add(jp1_jb3);
122}
123
124//构造函数
125public QqClientLogin(){
126//布局北部
127this.initNorthLayout();
128//布局中部
129this.initCenterLayout();
130//布局南部
131this.initSouthLayout();
132
133this.add(jbl1,"North");
134this.add(jtp,"Center");
135this.add(jp1,"South");
136
137this.setTitle("QQ登录界面");
138this.setResizable(false);
139this.setSize(350, 300);
140this.setLocationRelativeTo(null);
141this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
142this.setVisible(true);
143}
144