6.面向对象程序设计(2)

 

view包

 1 package view;

 2 

 3 import java.awt.event.MouseAdapter;

 4 import java.awt.event.MouseEvent;

 5 

 6 import javax.swing.ImageIcon;

 7 import javax.swing.JFrame;

 8 import javax.swing.JLabel;

 9 

10 @SuppressWarnings("serial")

11 public class QqClientZiliao extends JFrame {

12 

13     static JFrame qqClientZiliao;

14     JLabel ziliaoJLabel;

15 

16     public QqClientZiliao() {

17         qqClientZiliao = new JFrame();

18         ziliaoJLabel = new JLabel(new ImageIcon("image/main/ziliao.png"));

19         // 窗口

20         qqClientZiliao.setUndecorated(true);

21         // qqClientZiliao.setVisible(true);

22         qqClientZiliao.setAlwaysOnTop(true);

23         qqClientZiliao.setBounds(769, 55, 275, 313);

24         qqClientZiliao.setResizable(false);

25         qqClientZiliao.setLayout(null);

26         qqClientZiliao.add(ziliaoJLabel);

27         ziliaoJLabel.setBounds(0, 0, 275, 313);

28         ziliaoJLabel.addMouseListener(new MouseAdapter() {

29             public void mouseExited(MouseEvent e) {

30                 qqClientZiliao.setVisible(false);

31             }

32         });

33     }

34 

35     public static void main(String[] args) {

36         new QqClientZiliao();

37     }

38 }
package view;



import static org.junit.Assert.*;



import org.junit.Test;



public class QqClientLoginTest {



	@Test

	public void test() {

		fail("Not yet implemented");

	}



}

 

package view;



/**

 * 登陆界面*/

import java.awt.Checkbox;

import java.awt.CheckboxGroup;

import java.awt.Color;

import java.awt.Font;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.event.MouseMotionListener;

import java.io.DataOutputStream;

import java.io.IOException;

import java.net.Socket;

import java.net.UnknownHostException;



import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;



import msg.MsgReg;

import tools.RandomGetYanzheng;

import tools.RoundButton;

import client.ClientConServer;



@SuppressWarnings("serial")

public class QqClientLogin extends JFrame implements MouseListener,

		MouseMotionListener {





	//



	private ClientConServer ccs = ClientConServer.getCcs();



	// 定义 窗口

	JFrame qqClientLoginJFrame;

	//

	Drag drag;

	// 定义 登陆界面 换肤界面 申请账号界面

	JPanel qqClientLoginJPanel, changeSkinJPanel, applyJPanel;

	// 定义 登陆部分

	// 定义 账号密码字体大小

	Font mimaFont, zhanghaoInputFont, yanzhengInputFont;

	// 定义 账号输入区域

	JTextField zhanghaoJTextField;

	// 定义 密码输入区域

	JPasswordField mimaJPasswordField;

	// 定义 圆形按钮 申请 登陆 退出 说明

	RoundButton applyRoundButton, loginRoundButton, exitRoundButton,

			shuomingRoundButton, locationRoundButton;

	// 申请面板部分

	// 定义 姓名 输入字体

	// Font nameFont;

	// 定义 姓名 申请密码 确认密码 性别 标签

	JLabel nameJLabel, applyMimaJLabel, ifSureMimaJLabel, sexJLabel;

	// 定义 姓名输入组件

	JTextField nameJTextField;

	// 定义 密码 确认密码输入组件

	JPasswordField applyMimaJPasswordField, ifSureMimaJPasswordField;

	// 定义 密码与确认密码是否一致 红色提示

	JLabel ifSureMimaTishiJLabel;

	// 定义 按钮 注册返回 头像

	RoundButton zhuceJButton, zhuceBackJButton;

	JButton touxiang1, touxiang2, touxiang3, touxiang4, touxiang1_, touxiang2_,

			touxiang3_, touxiang4_, touxiang11, touxiang22, touxiang33,

			touxiang44;

	int nowTouxiangInt;

	// 定义 性别选择组件

	CheckboxGroup sexCheckboxGroup;

	Checkbox man, woman;

	// 定义验证码 输入以及随机标签

	JTextField yanzhengJTextField;

	JLabel yanzhengJLabel;

	JLabel yanzhengInputJLabel;

	// 定义验证码 随机字条

	RandomGetYanzheng yanzhengmaRandon;

	String yanzhengmaString;

	// 登陆位置设定

	JButton left1, right1, left2, right2, left3, right3, left4, right4;

	JButton left1_, right1_, left2_, right2_, left3_, right3_, left4_, right4_;

	// 背景部分

	// 进入选择背景界面 按钮

	JButton changeSkinLoginJButton, changeSkinLoginJButton1,

			changeSkinLoginJButton2, changeSkinLoginJButton3;

	// 选择处背景

	JButton changeSkinJButton, changeSkinJButton1, changeSkinJButton2,

			changeSkinJButton3;

	// 带对号的选择处背景

	JButton changeSkinJButton_, changeSkinJButton1_, changeSkinJButton2_,

			changeSkinJButton3_;

	// 主窗体背景

	JLabel beijing1JLabel, beijing2JLabel, beijing3JLabel, beijing4JLabel,

			applyJLabel1, applyJLabel2, applyJLabel3, applyJLabel4;

	// 定义 当前背景参数 当前申请界面背景参数

	String nowBeijingString, nowWeizhiString;

	boolean ifWeizhi;

	// 向服务器发送信息

	// 发送性别部分

	String sexString;

	MsgReg zhuceMr;

	DataOutputStream zhuceDous;

	Socket socket;

	byte[] zhuceB;

	// 发送

	// 登陆部分

	// 4种风格 JLabel

	JLabel skin1top;



	@SuppressWarnings("deprecation")

	public QqClientLogin() {



		// 初始化 字符串 当前背景 参数

		nowBeijingString = "beijing1JLabel";

		nowWeizhiString = "right";

		nowTouxiangInt = 4;

		ifWeizhi = false;

		//

		applyJLabel1 = new JLabel(new ImageIcon("image/loginJiemian/1-5.jpg"));

		applyJLabel2 = new JLabel(new ImageIcon("image/loginJiemian/2-5.png"));

		applyJLabel3 = new JLabel(new ImageIcon("image/loginJiemian/3-5.jpg"));

		applyJLabel4 = new JLabel(new ImageIcon("image/loginJiemian/4-5.jpg"));

		// 初始化 窗口

		qqClientLoginJFrame = new JFrame();

		// 设为 final 内部类使用 窗口

		final JFrame qqClientLoginJFrame = this;

		// 初始化 登陆面板

		qqClientLoginJPanel = new JPanel();

		// 初始化 换肤面板

		changeSkinJPanel = new JPanel();

		// 初始化申请面板

		applyJPanel = new JPanel();

		// 初始化 4种登陆界面 背景

		beijing1JLabel = new JLabel(new ImageIcon("image/loginJiemian/1-1.jpg"));

		beijing2JLabel = new JLabel(new ImageIcon("image/loginJiemian/2-1.png"));

		beijing3JLabel = new JLabel(new ImageIcon("image/loginJiemian/3-1.jpg"));

		beijing4JLabel = new JLabel(new ImageIcon("image/loginJiemian/4-1.jpg"));

		// 初始化 4种进入换肤界面的按钮

		changeSkinLoginJButton = new JButton(new ImageIcon(

				"image/loginJiemian/1-2.jpg"));

		changeSkinLoginJButton1 = new JButton(new ImageIcon(

				"image/loginJiemian/2-2.png"));

		changeSkinLoginJButton2 = new JButton(new ImageIcon(

				"image/loginJiemian/3-2.jpg"));

		changeSkinLoginJButton3 = new JButton(new ImageIcon(

				"image/loginJiemian/4-2.jpg"));

		// 初始化 4种 换肤面板的换肤按钮

		changeSkinJButton = new JButton(new ImageIcon(

				"image/loginJiemian/1-3.jpg"));

		changeSkinJButton1 = new JButton(new ImageIcon(

				"image/loginJiemian/2-3.png"));

		changeSkinJButton2 = new JButton(new ImageIcon(

				"image/loginJiemian/3-3.jpg"));

		changeSkinJButton3 = new JButton(new ImageIcon(

				"image/loginJiemian/4-3.jpg"));

		// 初始化 4种 对勾换肤按钮

		changeSkinJButton_ = new JButton(new ImageIcon(

				"image/loginJiemian/1-4.jpg"));

		changeSkinJButton1_ = new JButton(new ImageIcon(

				"image/loginJiemian/2-4.png"));

		changeSkinJButton2_ = new JButton(new ImageIcon(

				"image/loginJiemian/3-4.jpg"));

		changeSkinJButton3_ = new JButton(new ImageIcon(

				"image/loginJiemian/4-4.jpg"));

		// 初始化 登陆面板部分

		zhanghaoJTextField = new JTextField("请输入账号:");

		mimaJPasswordField = new JPasswordField();

		applyRoundButton = new RoundButton("申请");

		loginRoundButton = new RoundButton("登陆");

		exitRoundButton = new RoundButton("退出");

		shuomingRoundButton = new RoundButton("说明");

		// 初始化 登陆位置

		left1 = new JButton(new ImageIcon("image/loginJiemian/left_1.jpg"));

		right1 = new JButton(new ImageIcon("image/loginJiemian/right_1.jpg"));

		left2 = new JButton(new ImageIcon("image/loginJiemian/left_2.png"));

		right2 = new JButton(new ImageIcon("image/loginJiemian/right_2.png"));

		left3 = new JButton(new ImageIcon("image/loginJiemian/left_3.jpg"));

		right3 = new JButton(new ImageIcon("image/loginJiemian/right_3.jpg"));

		left4 = new JButton(new ImageIcon("image/loginJiemian/left_4.jpg"));

		right4 = new JButton(new ImageIcon("image/loginJiemian/right_4.jpg"));

		left1_ = new JButton(new ImageIcon("image/loginJiemian/left_11.jpg"));

		right1_ = new JButton(new ImageIcon("image/loginJiemian/right_11.jpg"));

		left2_ = new JButton(new ImageIcon("image/loginJiemian/left_22.png"));

		right2_ = new JButton(new ImageIcon("image/loginJiemian/right_22.png"));

		left3_ = new JButton(new ImageIcon("image/loginJiemian/left_33.jpg"));

		right3_ = new JButton(new ImageIcon("image/loginJiemian/right_33.jpg"));

		left4_ = new JButton(new ImageIcon("image/loginJiemian/left_44.jpg"));

		right4_ = new JButton(new ImageIcon("image/loginJiemian/right_44.jpg"));

		// 初始化 申请面板部分

		locationRoundButton = new RoundButton("位置");

		zhuceJButton = new RoundButton("注册");

		zhuceBackJButton = new RoundButton("返回");

		touxiang1 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-1.png"));

		touxiang2 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-2.png"));

		touxiang3 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-3.png"));

		touxiang4 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-4.png"));

		touxiang11 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-11.png"));

		touxiang22 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-22.png"));

		touxiang33 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-33.png"));

		touxiang44 = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-44.png"));

		touxiang1_ = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-1_.png"));

		touxiang2_ = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-2_.png"));

		touxiang3_ = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-3_.png"));

		touxiang4_ = new JButton(new ImageIcon(

				"image/loginJiemian/touxiang-4_.png"));

		nameJLabel = new JLabel("昵称");

		applyMimaJLabel = new JLabel("密码");

		ifSureMimaJLabel = new JLabel("确认密码");

		ifSureMimaTishiJLabel = new JLabel("密码与确认密码不一致");

		sexJLabel = new JLabel("性别");

		nameJTextField = new JTextField("");

		applyMimaJPasswordField = new JPasswordField("");

		ifSureMimaJPasswordField = new JPasswordField("");

		sexCheckboxGroup = new CheckboxGroup();

		man = new Checkbox();

		woman = new Checkbox();

		yanzhengJTextField = new JTextField("");

		yanzhengJLabel = new JLabel("验证码");

		yanzhengmaRandon = new RandomGetYanzheng();

		yanzhengmaString = yanzhengmaRandon.randomGetFiveBitYanzheng();

		yanzhengInputJLabel = new JLabel(yanzhengmaString);

		mimaFont = new Font("SansSerif", Font.BOLD, 17);

		zhanghaoInputFont = new Font("SansSerif", Font.BOLD, 17);

		yanzhengInputFont = new Font("SansSerif", Font.BOLD, 25);



		try {

			socket = new Socket("localhost", 9999);

		} catch (UnknownHostException e3) {

			// TODO Auto-generated catch block

			e3.printStackTrace();

		} catch (IOException e3) {

			// TODO Auto-generated catch block

			e3.printStackTrace();

		}



		zhuceMr = new MsgReg();

		//

		sexString = "男";

		// 登陆部分

		skin1top = new JLabel(new ImageIcon("image/listJiemian01/top.jpg"));

		// 窗口

		qqClientLoginJFrame.setUndecorated(true);

		drag = new Drag(qqClientLoginJFrame);



		drag.setDragable();

		qqClientLoginJFrame.setTitle("LZChat");

		qqClientLoginJFrame.setSize(600, 270);

		qqClientLoginJFrame.setResizable(false);

		qqClientLoginJFrame.setLocationRelativeTo(null);

		qqClientLoginJFrame.setVisible(true);

		qqClientLoginJFrame.setLayout(null);

		qqClientLoginJFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);

		// 登陆部分

		zhanghaoJTextField.setFont(zhanghaoInputFont);

		zhanghaoJTextField.setBounds(275, 140, 150, 35);

		mimaJPasswordField.setFont(mimaFont);

		mimaJPasswordField.setBounds(275, 205, 150, 35);

		applyRoundButton.setBounds(210, 125, 60, 60);

		applyRoundButton.setBackground(Color.WHITE);

		loginRoundButton.setBounds(430, 125, 60, 60);

		loginRoundButton.setBackground(Color.WHITE);

		exitRoundButton.setBounds(430, 190, 60, 60);

		exitRoundButton.setBackground(Color.WHITE);

		locationRoundButton.setBounds(430, 55, 60, 60);

		locationRoundButton.setBackground(Color.WHITE);

		shuomingRoundButton.setBounds(210, 190, 60, 60);

		shuomingRoundButton.setBackground(Color.WHITE);

		// 主面板

		qqClientLoginJPanel.setBounds(0, 0, 510, 272);

		qqClientLoginJPanel.setBackground(Color.YELLOW);

		qqClientLoginJPanel.setLayout(null);

		qqClientLoginJFrame.add(qqClientLoginJPanel);

		qqClientLoginJFrame.add(changeSkinLoginJButton);

		qqClientLoginJPanel.add(zhanghaoJTextField);

		qqClientLoginJPanel.add(mimaJPasswordField);

		qqClientLoginJPanel.add(applyRoundButton);

		qqClientLoginJPanel.add(loginRoundButton);

		qqClientLoginJPanel.add(exitRoundButton);

		qqClientLoginJPanel.add(locationRoundButton);

		qqClientLoginJPanel.add(shuomingRoundButton);

		qqClientLoginJPanel.add(beijing1JLabel);

		beijing1JLabel.setBounds(0, 0, 510, 272);

		// 按钮监听 说明 申请 登陆 退出



		// 位置按钮监听部分

		left1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(left1);

				qqClientLoginJFrame.add(left1_);

				left1_.setBounds(600, 0, 90, 135);

				qqClientLoginJFrame.remove(right1_);

				qqClientLoginJFrame.add(right1);

				right1.setBounds(600, 135, 90, 135);

				nowWeizhiString = "left";

				qqClientLoginJFrame.repaint();



			}

		});

		left2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(left2);

				qqClientLoginJFrame.add(left2_);

				left2_.setBounds(600, 0, 90, 135);

				qqClientLoginJFrame.remove(right2_);

				qqClientLoginJFrame.add(right2);

				right2.setBounds(600, 135, 90, 135);

				nowWeizhiString = "left";

				qqClientLoginJFrame.repaint();

			}

		});

		left3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(left3);

				qqClientLoginJFrame.add(left3_);

				left3_.setBounds(600, 0, 90, 135);

				qqClientLoginJFrame.remove(right3_);

				qqClientLoginJFrame.add(right3);

				right3.setBounds(600, 135, 90, 135);

				nowWeizhiString = "left";

				qqClientLoginJFrame.repaint();

			}

		});

		left4.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(left4);

				qqClientLoginJFrame.add(left4_);

				left4_.setBounds(600, 0, 90, 135);

				qqClientLoginJFrame.remove(right4_);

				qqClientLoginJFrame.add(right4);

				right4.setBounds(600, 135, 90, 135);

				nowWeizhiString = "left";

				qqClientLoginJFrame.repaint();

			}

		});

		right1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(right1);

				qqClientLoginJFrame.add(right1_);

				right1_.setBounds(600, 135, 90, 135);

				qqClientLoginJFrame.remove(left1_);

				qqClientLoginJFrame.add(left1);

				left1.setBounds(600, 0, 90, 135);

				nowWeizhiString = "right";

				qqClientLoginJFrame.repaint();

			}

		});

		right2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(right2);

				qqClientLoginJFrame.add(right2_);

				right2_.setBounds(600, 135, 90, 135);

				qqClientLoginJFrame.remove(left2_);

				qqClientLoginJFrame.add(left2);

				left2.setBounds(600, 0, 90, 135);

				nowWeizhiString = "right";

				qqClientLoginJFrame.repaint();

			}

		});

		right3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(right3);

				qqClientLoginJFrame.add(right3_);

				right3_.setBounds(600, 135, 90, 135);

				qqClientLoginJFrame.remove(left3_);

				qqClientLoginJFrame.add(left3);

				left3.setBounds(600, 0, 90, 135);

				nowWeizhiString = "right";

				qqClientLoginJFrame.repaint();

			}

		});

		right4.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientLoginJFrame.remove(right4);

				qqClientLoginJFrame.add(right4_);

				right4_.setBounds(600, 135, 90, 135);

				qqClientLoginJFrame.remove(left4_);

				qqClientLoginJFrame.add(left4);

				left4.setBounds(600, 0, 90, 135);

				nowWeizhiString = "right";

				qqClientLoginJFrame.repaint();

			}

		});

		//

		applyRoundButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				yanzhengmaRandon.changeGetFiveBitYanzheng();

				applyJPanel.repaint();

				System.out.println("申请按钮");

				qqClientLoginJFrame.remove(qqClientLoginJPanel);

				qqClientLoginJFrame.add(applyJPanel);



				qqClientLoginJFrame.repaint();



			}

		});

		loginRoundButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("登陆按钮");



				//

				if (ccs.ConServer()) {

					if (ccs.loginServer(

							Integer.valueOf(zhanghaoJTextField.getText()),

							mimaJPasswordField.getText())) {



						// 登陆不同风格界面部分

						if (nowBeijingString == "beijing1JLabel") {

							if (nowWeizhiString == "right") {

								QqClientFriendsList01 qqClientFriendsList01 = new QqClientFriendsList01();

								qqClientFriendsList01.setLocationRight();

								ccs.addMsgListener(qqClientFriendsList01);

								// 左零右一

								qqClientLoginJFrame.setVisible(false);

							}

							if (nowWeizhiString == "left") {

								QqClientFriendsList01 qqClientFriendsList01 = new QqClientFriendsList01();

								qqClientFriendsList01.setLocationLeft();

								ccs.addMsgListener(qqClientFriendsList01);



								qqClientLoginJFrame.setVisible(false);

							}



						}

						if (nowBeijingString == "beijing2JLabel") {

							if (nowWeizhiString == "right") {

								QqClientFriendsList02 qqClientFriendsList02 = new QqClientFriendsList02();

								qqClientFriendsList02.setLocationRight();

								ccs.addMsgListener(qqClientFriendsList02);

								// 左零右一

								qqClientLoginJFrame.setVisible(false);

							}

							if (nowWeizhiString == "left") {

								QqClientFriendsList02 qqClientFriendsList02 = new QqClientFriendsList02();

								qqClientFriendsList02.setLocationLeft();

								ccs.addMsgListener(qqClientFriendsList02);



								qqClientLoginJFrame.setVisible(false);

							}

						}

						if (nowBeijingString == "beijing3JLabel") {

							if (nowWeizhiString == "right") {

								QqClientFriendsList03 qqClientFriendsList03 = new QqClientFriendsList03();

								qqClientFriendsList03.setLocationRight();

								ccs.addMsgListener(qqClientFriendsList03);

								// 左零右一

								qqClientLoginJFrame.setVisible(false);

							}

							if (nowWeizhiString == "left") {

								QqClientFriendsList03 qqClientFriendsList03 = new QqClientFriendsList03();

								qqClientFriendsList03.setLocationLeft();

								ccs.addMsgListener(qqClientFriendsList03);



								qqClientLoginJFrame.setVisible(false);

							}

						}

						if (nowBeijingString == "beijing4JLabel") {

							if (nowWeizhiString == "right") {

								QqClientFriendsList04 qqClientFriendsList04 = new QqClientFriendsList04();

								qqClientFriendsList04.setLocationRight();

								ccs.addMsgListener(qqClientFriendsList04);

								// 左零右一

								qqClientLoginJFrame.setVisible(false);

							}

							if (nowWeizhiString == "left") {

								QqClientFriendsList04 qqClientFriendsList04 = new QqClientFriendsList04();

								qqClientFriendsList04.setLocationLeft();

								ccs.addMsgListener(qqClientFriendsList04);



								qqClientLoginJFrame.setVisible(false);

							}

						}

						// 以上是登陆部分

						ccs.start();

					} else {

						ccs.closeMe();

						JOptionPane.showMessageDialog(null, "登陆失败,请确认信息正确!");

					}



				} else {

					ccs.closeMe();

					JOptionPane.showMessageDialog(null,

							"连结失败,请确认服务器开启,IP和端口正确!");

				}



			}

		});

		exitRoundButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出按钮");

				System.exit(0);

			}

		});

		// 账号申请部分

		applyJPanel.setBounds(0, 0, 510, 272);

		applyJPanel.setLayout(null);

		applyJPanel.setBackground(Color.WHITE);

		applyJPanel.add(nameJLabel);

		applyJPanel.add(applyMimaJLabel);

		applyJPanel.add(ifSureMimaJLabel);

		applyJPanel.add(sexJLabel);

		applyJPanel.add(yanzhengJTextField);

		applyJPanel.add(yanzhengJLabel);

		applyJPanel.add(yanzhengInputJLabel);



		nameJLabel.setBounds(90, 40, 100, 30);

		applyMimaJLabel.setBounds(90, 75, 100, 30);

		ifSureMimaJLabel.setBounds(73, 110, 100, 30);

		sexJLabel.setBounds(90, 147, 100, 30);

		yanzhengJLabel.setBounds(80, 185, 100, 30);



		applyJPanel.add(nameJTextField);

		applyJPanel.add(applyMimaJPasswordField);

		applyJPanel.add(ifSureMimaJPasswordField);

		nameJTextField.setBounds(170, 40, 140, 30);

		applyMimaJPasswordField.setBounds(170, 75, 140, 30);

		ifSureMimaJPasswordField.setBounds(170, 110, 140, 30);

		yanzhengJTextField.setBounds(175, 180, 90, 40);

		yanzhengInputJLabel.setBounds(275, 180, 100, 40);



		// 设置字体

		nameJLabel.setFont(zhanghaoInputFont);

		nameJTextField.setFont(zhanghaoInputFont);

		applyMimaJLabel.setFont(zhanghaoInputFont);

		applyMimaJPasswordField.setFont(zhanghaoInputFont);

		ifSureMimaJLabel.setFont(zhanghaoInputFont);

		ifSureMimaJPasswordField.setFont(zhanghaoInputFont);

		sexJLabel.setFont(zhanghaoInputFont);

		yanzhengJLabel.setFont(zhanghaoInputFont);

		yanzhengJTextField.setFont(yanzhengInputFont);

		yanzhengInputJLabel.setFont(yanzhengInputFont);



		man = new Checkbox("男", sexCheckboxGroup, false);

		woman = new Checkbox("女", sexCheckboxGroup, false);

		sexCheckboxGroup.setSelectedCheckbox(man);

		man.setFont(zhanghaoInputFont);

		woman.setFont(zhanghaoInputFont);

		man.setBounds(190, 150, 35, 20);

		woman.setBounds(250, 150, 35, 20);

		applyJPanel.add(man);

		applyJPanel.add(woman);

		// 按钮

		applyJPanel.add(zhuceJButton);

		applyJPanel.add(zhuceBackJButton);

		applyJPanel.add(touxiang4);

		zhuceJButton.setBounds(385, 150, 100, 50);

		zhuceJButton.setBackground(Color.CYAN);

		zhuceBackJButton.setBounds(385, 210, 100, 50);

		zhuceBackJButton.setBackground(Color.CYAN);

		touxiang4.setBounds(400, 40, 60, 60);

		applyJPanel.add(applyJLabel1);

		applyJLabel1.setBounds(0, 0, 510, 272);

		// 切换头像

		touxiang1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");

				applyJPanel.add(touxiang1_);

				applyJPanel.add(touxiang22);

				applyJPanel.add(touxiang33);

				applyJPanel.add(touxiang44);

				touxiang1_.setBounds(340, 40, 30, 30);

				touxiang22.setBounds(340, 70, 30, 30);

				touxiang33.setBounds(340, 100, 30, 30);

				touxiang44.setBounds(340, 130, 30, 30);

				applyJPanel.repaint();



				applyJPanel.remove(applyJLabel1);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);



			}

		});

		touxiang2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");

				applyJPanel.add(touxiang11);

				applyJPanel.add(touxiang2_);

				applyJPanel.add(touxiang33);

				applyJPanel.add(touxiang44);

				touxiang11.setBounds(340, 40, 30, 30);

				touxiang2_.setBounds(340, 70, 30, 30);

				touxiang33.setBounds(340, 100, 30, 30);

				touxiang44.setBounds(340, 130, 30, 30);

				applyJPanel.repaint();

				applyJPanel.remove(applyJLabel1);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);



			}

		});

		touxiang3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");

				applyJPanel.add(touxiang11);

				applyJPanel.add(touxiang22);

				applyJPanel.add(touxiang3_);

				applyJPanel.add(touxiang44);

				touxiang11.setBounds(340, 40, 30, 30);

				touxiang22.setBounds(340, 70, 30, 30);

				touxiang3_.setBounds(340, 100, 30, 30);

				touxiang44.setBounds(340, 130, 30, 30);

				applyJPanel.repaint();

				applyJPanel.remove(applyJLabel1);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);



			}

		});

		touxiang4.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");

				applyJPanel.add(touxiang11);

				applyJPanel.add(touxiang22);

				applyJPanel.add(touxiang33);

				applyJPanel.add(touxiang4_);

				touxiang11.setBounds(340, 40, 30, 30);

				touxiang22.setBounds(340, 70, 30, 30);

				touxiang33.setBounds(340, 100, 30, 30);

				touxiang4_.setBounds(340, 130, 30, 30);

				applyJPanel.repaint();

				applyJPanel.remove(applyJLabel1);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);



			}

		});

		touxiang11.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");



				if (nowTouxiangInt == 2) {

					applyJPanel.remove(touxiang2);



					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang2_);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang44);

				}

				if (nowTouxiangInt == 3) {

					applyJPanel.remove(touxiang3);

					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang3_);

					applyJPanel.remove(touxiang44);

				}

				if (nowTouxiangInt == 4) {

					applyJPanel.remove(touxiang4);

					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang4_);



				}

				applyJPanel.add(touxiang1);

				touxiang1.setBounds(400, 40, 60, 60);

				applyJPanel.remove(applyJLabel1);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);

				applyJPanel.repaint();

				nowTouxiangInt = 1;

			}



		});



		touxiang22.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");

				if (nowTouxiangInt == 1) {

					applyJPanel.remove(touxiang1);

					applyJPanel.remove(touxiang1_);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang44);

				}

				if (nowTouxiangInt == 3) {

					applyJPanel.remove(touxiang3);

					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang3_);

					applyJPanel.remove(touxiang44);

				}

				if (nowTouxiangInt == 4) {

					applyJPanel.remove(touxiang4);

					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang4_);

				}

				applyJPanel.add(touxiang2);

				touxiang2.setBounds(400, 40, 60, 60);

				applyJPanel.remove(applyJLabel2);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);

				applyJPanel.repaint();

				nowTouxiangInt = 2;

			}

		});

		touxiang33.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");



				if (nowTouxiangInt == 1) {

					applyJPanel.remove(touxiang1);

					applyJPanel.remove(touxiang1_);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang44);

				}

				if (nowTouxiangInt == 2) {

					applyJPanel.remove(touxiang2);

					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang2_);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang44);

				}

				if (nowTouxiangInt == 4) {

					applyJPanel.remove(touxiang4);

					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang4_);

				}

				applyJPanel.add(touxiang3);

				touxiang3.setBounds(400, 40, 60, 60);

				applyJPanel.remove(applyJLabel1);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);

				applyJPanel.repaint();

				nowTouxiangInt = 3;

			}

		});

		touxiang44.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("切换头像");



				if (nowTouxiangInt == 1) {

					applyJPanel.remove(touxiang1);



					applyJPanel.remove(touxiang1_);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang44);



				}

				if (nowTouxiangInt == 2) {

					applyJPanel.remove(touxiang2);



					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang2_);

					applyJPanel.remove(touxiang33);

					applyJPanel.remove(touxiang44);



				}

				if (nowTouxiangInt == 3) {

					applyJPanel.remove(touxiang3);



					applyJPanel.remove(touxiang11);

					applyJPanel.remove(touxiang22);

					applyJPanel.remove(touxiang3_);

					applyJPanel.remove(touxiang44);

				}

				applyJPanel.add(touxiang4);

				touxiang4.setBounds(400, 40, 60, 60);

				applyJPanel.remove(applyJLabel1);

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);

				applyJPanel.repaint();

				nowTouxiangInt = 4;

			}

		});



		zhuceJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("注册按钮");

				// JOptionPane.showMessageDialog(null, "未连接服务器");

				// 向服务器发送信息

				if (nameJTextField.getText().equals("")

						&& ifSureMimaJPasswordField.getText().equals("")

						&& mimaJPasswordField.getText().equals("")

						&& yanzhengJTextField.getText().equals("")) {



					JOptionPane.showMessageDialog(null, "请完善信息!");



				} else {

					if (nameJTextField.getText().equals("")) {

						JOptionPane.showMessageDialog(null, "请填写昵称!");

					}

					if (applyMimaJPasswordField.getText().equals("")) {

						JOptionPane.showMessageDialog(null, "请填写密码!");

					}

					if (ifSureMimaJPasswordField.getText().equals("")) {

						JOptionPane.showMessageDialog(null, "请填写确认密码!");



					}



					if (yanzhengJTextField.getText().equals("")) {

						JOptionPane.showMessageDialog(null, "请填写验证码!");

					} else {

						if (yanzhengJTextField.getText().equals(

								yanzhengmaString)) {

							if (ifSureMimaJPasswordField.getText().equals(

									applyMimaJPasswordField.getText())) {



								// 符合条件成功传送

								// JOptionPane.showMessageDialog(null, "传送成功!");



								if (ccs.ConServer()) {

									int qq = ccs.regServer(

											ifSureMimaJPasswordField.getText(),

											nameJTextField.getText(),

											sexCheckboxGroup

													.getSelectedCheckbox()

													.getLabel(),

											(byte) nowTouxiangInt);

									String s = "注册失败!";

									if (qq != -1) {

										s = "注册成功,你的账号:" + qq;

									}

									javax.swing.JOptionPane.showMessageDialog(

											null, s);

									ccs.closeMe();

									// 返回到登陆界面

									qqClientLoginJFrame.remove(applyJPanel);

									qqClientLoginJFrame

											.add(qqClientLoginJPanel);

									qqClientLoginJPanel.setBounds(0, 0, 510,

											272);

									qqClientLoginJFrame.repaint();

								}

							} else {

								JOptionPane.showMessageDialog(null,

										"输入密码与确认密码不一致!");

							}

						} else {

							JOptionPane.showMessageDialog(null, "验证码填写有误!");



						}

					}



				}



			}

		});

		zhuceBackJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("返回按钮");

				qqClientLoginJFrame.remove(applyJPanel);

				qqClientLoginJFrame.add(qqClientLoginJPanel);

				qqClientLoginJFrame.repaint();



			}

		});

		// 确认密码 与密码不一致监听

		ifSureMimaJPasswordField.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (ifSureMimaJPasswordField.getText().equals(

						applyMimaJPasswordField.getText())) {



				} else {

					System.out.println("点击ifSureMimaJPasswordField组件");

					applyJPanel.remove(applyJLabel1);

					applyJPanel.add(ifSureMimaTishiJLabel);

					ifSureMimaTishiJLabel.setForeground(Color.red);

					ifSureMimaTishiJLabel.setBounds(193, 110, 100, 30);

					applyJPanel.add(applyJLabel1);

					applyJLabel1.setBounds(0, 0, 510, 272);



				}

				qqClientLoginJFrame.repaint();



			}

		});

		// 特点功能实现:3种皮肤切换

		changeSkinJButton_.setBackground(Color.RED);

		changeSkinJButton_.setBounds(0, 0, 510, 68);

		changeSkinJButton1.setBackground(Color.RED);

		changeSkinJButton1.setBounds(0, 68, 510, 67);

		changeSkinJButton2.setBackground(Color.BLUE);

		changeSkinJButton2.setBounds(0, 135, 510, 67);

		changeSkinJButton3.setBackground(Color.YELLOW);

		changeSkinJButton3.setBounds(0, 202, 510, 68);

		// 更换皮肤面板

		changeSkinJPanel.setLayout(null);

		changeSkinJPanel.setBackground(Color.WHITE);

		changeSkinJPanel.add(changeSkinJButton_);

		changeSkinJPanel.add(changeSkinJButton1);

		changeSkinJPanel.add(changeSkinJButton2);

		changeSkinJPanel.add(changeSkinJButton3);

		// 更换皮肤按钮

		// changeSkinJButton.setBounds(0, 0, 600, 50);

		changeSkinLoginJButton.setBounds(510, 0, 90, 272);

		changeSkinLoginJButton.setBackground(Color.CYAN);



		changeSkinLoginJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("更换皮肤按钮");

				qqClientLoginJFrame.add(changeSkinJPanel);

				qqClientLoginJFrame.remove(qqClientLoginJPanel);

				qqClientLoginJFrame.remove(applyJPanel);

				changeSkinJPanel.setBounds(0, 0, 510, 272);

				changeSkinJPanel.repaint();



			}

		});

		changeSkinLoginJButton1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("更换皮肤按钮");

				qqClientLoginJFrame.add(changeSkinJPanel);

				qqClientLoginJFrame.remove(qqClientLoginJPanel);

				qqClientLoginJFrame.remove(applyJPanel);

				changeSkinJPanel.setBounds(0, 0, 510, 272);

				changeSkinJPanel.repaint();



			}

		});

		changeSkinLoginJButton2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("更换皮肤按钮");

				qqClientLoginJFrame.add(changeSkinJPanel);

				qqClientLoginJFrame.remove(qqClientLoginJPanel);

				qqClientLoginJFrame.remove(applyJPanel);

				changeSkinJPanel.setBounds(0, 0, 510, 272);

				changeSkinJPanel.repaint();



			}

		});

		changeSkinLoginJButton3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("更换皮肤按钮");

				qqClientLoginJFrame.add(changeSkinJPanel);

				qqClientLoginJFrame.remove(qqClientLoginJPanel);

				qqClientLoginJFrame.remove(applyJPanel);

				changeSkinJPanel.setBounds(0, 0, 510, 272);

				changeSkinJPanel.repaint();



			}

		});

		// applyJPanel.add(applyJLabel1);

		// applyJLabel1.setBounds(0, 0, 510, 272);

		// 界面1

		changeSkinJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// 是否出现位置选择按钮



				if (ifWeizhi == true) {

					if (nowBeijingString == "beijing1JLabel") {

						qqClientLoginJFrame.remove(left1);

						qqClientLoginJFrame.remove(right1_);

					}

					if (nowBeijingString == "beijing2JLabel") {

						qqClientLoginJFrame.remove(left2);

						qqClientLoginJFrame.remove(right2_);

					}

					if (nowBeijingString == "beijing3JLabel") {

						qqClientLoginJFrame.remove(left3);

						qqClientLoginJFrame.remove(right3_);

					}

					if (nowBeijingString == "beijing4JLabel") {

						qqClientLoginJFrame.remove(left4);

						qqClientLoginJFrame.remove(right4_);

					}

					qqClientLoginJFrame.setSize(600, 270);

					ifWeizhi = false;

					qqClientLoginJFrame.repaint();

				} else {



				}

				// 换肤界面部分

				changeSkinJPanel.remove(changeSkinJButton);

				changeSkinJPanel.add(changeSkinJButton_);

				changeSkinJButton_.setBounds(0, 0, 510, 68);

				// 主界面部分

				qqClientLoginJFrame.remove(changeSkinJPanel);

				qqClientLoginJFrame.add(qqClientLoginJPanel);

				qqClientLoginJPanel.setBounds(0, 0, 510, 272);



				if (nowBeijingString == "beijing2JLabel") {



					changeSkinJPanel.remove(changeSkinJButton1_);

					changeSkinJPanel.add(changeSkinJButton1);

					changeSkinJButton1.setBounds(0, 68, 510, 68);



					qqClientLoginJPanel.remove(beijing2JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton1);

					nowBeijingString = "beijing1JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel2);

				}

				if (nowBeijingString == "beijing3JLabel") {

					changeSkinJPanel.remove(changeSkinJButton2_);

					changeSkinJPanel.add(changeSkinJButton2);

					changeSkinJButton2.setBounds(0, 135, 510, 68);



					qqClientLoginJPanel.remove(beijing3JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton2);

					nowBeijingString = "beijing1JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel3);

				}

				if (nowBeijingString == "beijing4JLabel") {

					changeSkinJPanel.remove(changeSkinJButton3_);

					changeSkinJPanel.add(changeSkinJButton3);

					changeSkinJButton3.setBounds(0, 202, 510, 68);



					qqClientLoginJPanel.remove(beijing4JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton3);



					nowBeijingString = "beijing1JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel4);

				}

				// 申请界面部分

				applyJPanel.add(applyJLabel1);

				applyJLabel1.setBounds(0, 0, 510, 272);

				//

				qqClientLoginJFrame.add(changeSkinLoginJButton);

				changeSkinLoginJButton.setBounds(510, 0, 90, 272);

				qqClientLoginJPanel.add(beijing1JLabel);

				beijing1JLabel.setBounds(0, 0, 510, 272);

				qqClientLoginJFrame.repaint();

				System.out.println(nowBeijingString);

				//



			}

		});

		// 界面2

		changeSkinJButton1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// 是否出现位置选择按钮



				if (ifWeizhi == true) {

					if (nowBeijingString == "beijing1JLabel") {

						qqClientLoginJFrame.remove(left1);

						qqClientLoginJFrame.remove(right1_);

					}

					if (nowBeijingString == "beijing2JLabel") {

						qqClientLoginJFrame.remove(left2);

						qqClientLoginJFrame.remove(right2_);

					}

					if (nowBeijingString == "beijing3JLabel") {

						qqClientLoginJFrame.remove(left3);

						qqClientLoginJFrame.remove(right3_);

					}

					if (nowBeijingString == "beijing4JLabel") {

						qqClientLoginJFrame.remove(left4);

						qqClientLoginJFrame.remove(right4_);

					}

					qqClientLoginJFrame.setSize(600, 270);

					ifWeizhi = false;

					qqClientLoginJFrame.repaint();

				} else {



				}

				changeSkinJPanel.remove(changeSkinJButton1);

				changeSkinJPanel.add(changeSkinJButton1_);

				changeSkinJButton1_.setBounds(0, 68, 510, 68);



				qqClientLoginJFrame.remove(changeSkinJPanel);

				qqClientLoginJFrame.add(qqClientLoginJPanel);



				qqClientLoginJPanel.setBounds(0, 0, 510, 272);

				if (nowBeijingString == "beijing1JLabel") {

					changeSkinJPanel.remove(changeSkinJButton_);

					changeSkinJPanel.add(changeSkinJButton);

					changeSkinJButton.setBounds(0, 0, 510, 68);



					qqClientLoginJPanel.remove(beijing1JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton);

					nowBeijingString = "beijing2JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel1);

				}

				if (nowBeijingString == "beijing3JLabel") {



					changeSkinJPanel.remove(changeSkinJButton2_);

					changeSkinJPanel.add(changeSkinJButton2);

					changeSkinJButton2.setBounds(0, 135, 510, 68);



					qqClientLoginJPanel.remove(beijing3JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton2);

					nowBeijingString = "beijing2JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel3);

				}

				if (nowBeijingString == "beijing4JLabel") {



					changeSkinJPanel.remove(changeSkinJButton3_);

					changeSkinJPanel.add(changeSkinJButton3);

					changeSkinJButton3.setBounds(0, 202, 510, 68);



					qqClientLoginJPanel.remove(beijing4JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton3);

					nowBeijingString = "beijing2JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel4);

				}

				// 申请界面部分

				applyJPanel.add(applyJLabel2);

				applyJLabel2.setBounds(0, 0, 510, 272);

				//

				qqClientLoginJFrame.add(changeSkinLoginJButton1);

				changeSkinLoginJButton1.setBounds(510, 0, 90, 272);

				qqClientLoginJPanel.add(beijing2JLabel);

				beijing2JLabel.setBounds(0, 0, 510, 272);

				qqClientLoginJFrame.repaint();

				System.out.println(nowBeijingString);

				//



			}

		});

		// 界面3

		changeSkinJButton2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// 是否出现位置选择按钮



				if (ifWeizhi == true) {

					if (nowBeijingString == "beijing1JLabel") {

						qqClientLoginJFrame.remove(left1);

						qqClientLoginJFrame.remove(right1_);

					}

					if (nowBeijingString == "beijing2JLabel") {

						qqClientLoginJFrame.remove(left2);

						qqClientLoginJFrame.remove(right2_);

					}

					if (nowBeijingString == "beijing3JLabel") {

						qqClientLoginJFrame.remove(left3);

						qqClientLoginJFrame.remove(right3_);

					}

					if (nowBeijingString == "beijing4JLabel") {

						qqClientLoginJFrame.remove(left4);

						qqClientLoginJFrame.remove(right4_);

					}

					qqClientLoginJFrame.setSize(600, 270);

					ifWeizhi = false;

					qqClientLoginJFrame.repaint();

				} else {



				}

				changeSkinJPanel.remove(changeSkinJButton2);

				changeSkinJPanel.add(changeSkinJButton2_);

				changeSkinJButton2_.setBounds(0, 135, 510, 68);



				qqClientLoginJFrame.remove(changeSkinJPanel);

				qqClientLoginJFrame.add(qqClientLoginJPanel);

				qqClientLoginJPanel.setBounds(0, 0, 510, 272);



				if (nowBeijingString == "beijing1JLabel") {

					changeSkinJPanel.remove(changeSkinJButton_);

					changeSkinJPanel.add(changeSkinJButton);

					changeSkinJButton.setBounds(0, 0, 510, 68);



					qqClientLoginJPanel.remove(beijing1JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton);

					nowBeijingString = "beijing3JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel1);

				}

				if (nowBeijingString == "beijing2JLabel") {

					changeSkinJPanel.remove(changeSkinJButton1_);

					changeSkinJPanel.add(changeSkinJButton1);

					changeSkinJButton1.setBounds(0, 68, 510, 68);



					qqClientLoginJPanel.remove(beijing2JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton1);

					nowBeijingString = "beijing3JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel2);

				}

				if (nowBeijingString == "beijing4JLabel") {

					changeSkinJPanel.remove(changeSkinJButton3_);

					changeSkinJPanel.add(changeSkinJButton3);

					changeSkinJButton3.setBounds(0, 202, 510, 68);



					qqClientLoginJPanel.remove(beijing4JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton3);

					nowBeijingString = "beijing3JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel4);

				}

				// 申请界面部分

				applyJPanel.add(applyJLabel3);

				applyJLabel3.setBounds(0, 0, 510, 272);

				//

				qqClientLoginJFrame.add(changeSkinLoginJButton2);

				changeSkinLoginJButton2.setBounds(510, 0, 90, 272);

				qqClientLoginJPanel.add(beijing3JLabel);

				beijing3JLabel.setBounds(0, 0, 510, 272);

				qqClientLoginJFrame.repaint();

				System.out.println(nowBeijingString);

				//



			}

		});

		// 界面4

		changeSkinJButton3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// 是否出现位置选择按钮



				if (ifWeizhi == true) {

					if (nowBeijingString == "beijing1JLabel") {

						qqClientLoginJFrame.remove(left1);

						qqClientLoginJFrame.remove(right1_);

					}

					if (nowBeijingString == "beijing2JLabel") {

						qqClientLoginJFrame.remove(left2);

						qqClientLoginJFrame.remove(right2_);

					}

					if (nowBeijingString == "beijing3JLabel") {

						qqClientLoginJFrame.remove(left3);

						qqClientLoginJFrame.remove(right3_);

					}

					if (nowBeijingString == "beijing4JLabel") {

						qqClientLoginJFrame.remove(left4);

						qqClientLoginJFrame.remove(right4_);

					}

					qqClientLoginJFrame.setSize(600, 270);

					ifWeizhi = false;

					qqClientLoginJFrame.repaint();

				} else {



				}

				changeSkinJPanel.remove(changeSkinJButton3);

				changeSkinJPanel.add(changeSkinJButton3_);

				changeSkinJButton3_.setBounds(0, 202, 510, 68);



				qqClientLoginJFrame.remove(changeSkinJPanel);

				qqClientLoginJFrame.add(qqClientLoginJPanel);

				qqClientLoginJPanel.setBounds(0, 0, 510, 272);



				if (nowBeijingString == "beijing1JLabel") {

					changeSkinJPanel.remove(changeSkinJButton_);

					changeSkinJPanel.add(changeSkinJButton);

					changeSkinJButton.setBounds(0, 0, 510, 68);



					qqClientLoginJPanel.remove(beijing1JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton);

					nowBeijingString = "beijing4JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel1);

				}

				if (nowBeijingString == "beijing2JLabel") {

					changeSkinJPanel.remove(changeSkinJButton1_);

					changeSkinJPanel.add(changeSkinJButton1);

					changeSkinJButton1.setBounds(0, 68, 510, 68);



					qqClientLoginJPanel.remove(beijing2JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton1);

					nowBeijingString = "beijing4JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel2);

				}

				if (nowBeijingString == "beijing3JLabel") {

					changeSkinJPanel.remove(changeSkinJButton2_);

					changeSkinJPanel.add(changeSkinJButton2);

					changeSkinJButton2.setBounds(0, 135, 510, 68);



					qqClientLoginJPanel.remove(beijing3JLabel);

					qqClientLoginJFrame.remove(changeSkinLoginJButton2);



					nowBeijingString = "beijing4JLabel";

					// 申请界面部分

					applyJPanel.remove(applyJLabel3);

				}

				// 申请界面部分

				applyJPanel.add(applyJLabel4);

				applyJLabel4.setBounds(0, 0, 510, 272);

				//

				qqClientLoginJFrame.add(changeSkinLoginJButton3);

				changeSkinLoginJButton3.setBounds(510, 0, 90, 272);

				qqClientLoginJPanel.add(beijing4JLabel);

				beijing4JLabel.setBounds(0, 0, 510, 272);

				qqClientLoginJFrame.repaint();

				System.out.println(nowBeijingString);

				//



			}

		});

		// 位置按钮监听

		locationRoundButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("位置按钮");

				if (ifWeizhi == true) {

					JOptionPane.showMessageDialog(null, "您已经打开位置选择面板!");

				} else {

					if (nowBeijingString == "beijing1JLabel") {

						ifWeizhi = true;



						qqClientLoginJFrame.setSize(690, 270);

						qqClientLoginJFrame.add(left1);

						left1.setBounds(600, 0, 90, 135);

						qqClientLoginJFrame.add(right1_);

						right1_.setBounds(600, 135, 90, 135);

					}

					if (nowBeijingString == "beijing2JLabel") {

						ifWeizhi = true;



						qqClientLoginJFrame.setSize(690, 270);

						qqClientLoginJFrame.add(left2);

						left2.setBounds(600, 0, 90, 135);

						qqClientLoginJFrame.add(right2_);

						right2_.setBounds(600, 135, 90, 135);

					}

					if (nowBeijingString == "beijing3JLabel") {

						ifWeizhi = true;



						qqClientLoginJFrame.setSize(690, 270);

						qqClientLoginJFrame.add(left3);

						left3.setBounds(600, 0, 90, 135);

						qqClientLoginJFrame.add(right3_);

						right3_.setBounds(600, 135, 90, 135);

					}

					if (nowBeijingString == "beijing4JLabel") {

						ifWeizhi = true;



						qqClientLoginJFrame.setSize(690, 270);

						qqClientLoginJFrame.add(left4);

						left4.setBounds(600, 0, 90, 135);

						qqClientLoginJFrame.add(right4_);

						right4_.setBounds(600, 135, 90, 135);

					}

				}



			}

		});

	}



	public static void main(String[] args) {

		new QqClientLogin();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseDragged(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseMoved(MouseEvent e) {

		// TODO Auto-generated method stub



	}



}

 

package view;



// Qq主窗口

import java.awt.AWTException;

import java.awt.Font;

import java.awt.SystemTray;

import java.awt.Toolkit;

import java.awt.TrayIcon;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.event.MouseMotionListener;

import java.io.File;

import java.io.IOException;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;



import javax.imageio.ImageIO;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JScrollPane;

import javax.swing.ScrollPaneConstants;



import model.TeamInfo;

import model.UserInfo;

import msg.MsgAddFriendResp;

import msg.MsgAddYou;

import msg.MsgChatText;

import msg.MsgFindResp;

import msg.MsgHead;

import msg.MsgPerData;

import msg.MsgTeamList;

import msg.MsgType;

import tools.RoundButton;

import client.ClientConServer;

import client.ClientMsgListener;



@SuppressWarnings("serial")

public class QqClientFriendsList04 extends JFrame implements MouseListener,

		MouseMotionListener, ClientMsgListener {

	// 定义各变量

	private ClientConServer ccs = ClientConServer.getCcs();



	private int count = 0;



	private int ownerqq;

	private JFrame qqClientFriendsList1;

	// 聊天界面的map String = "ownerqq otherqq"

	private Map<String, QqClientFriendsChat04> chats = new HashMap<String, QqClientFriendsChat04>();

	private QqClientFind04 qqClientFind04;



	private QqClientFriendsChat04 qqClientFriendsChat04;

	private int locationInt;

	// 从Login传入的 昵称和号码 变成JLabel

	JLabel nickNameJLabel, qqNumberJLabel, sexJLabel;

	// 昵称: 账号:

	JLabel nickNameForeJLabel, qqNumberForeJLabel, sexForeJLabel;

	// 头像

	JButton touxiang1, touxiang2, touxiang3, touxiang4;



	// 选择左边右边方法

	public void setLocationRight() {

		qqClientFriendsList1.setLocation(1050, 0);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFriendsList1.setLocation(0, 0);

		locationInt = 0;

	}



	private JLabel north, south, west, east, top;

	private JButton haoyou, moshengren, heimingdan, moshengren_, heimingdan_;

	// 好友列表部分

	private JLabel MyFriend1Name, MyFriend2Name, MyFriend3Name, MyFriend4Name,

			MyFriend5Name, MyFriend6Name, MyFriend7Name, MyFriend8Name,

			MyFriend9Name, moshengren1Name, heimingdan1Name;



	private JButton MyFriend1, MyFriend2, MyFriend3, MyFriend4, MyFriend5,

			MyFriend6, MyFriend7, MyFriend8, MyFriend9, moshengren1,

			heimingdan1;

	JButton[] MyFriendArray;

	JLabel[] MyFriendArrayName;

	int[] qqs = new int[9];

	// 定义头像图片

	ImageIcon touxiang1ImageIcon, touxiang2ImageIcon, touxiang3ImageIcon,

			touxiang4ImageIcon;

	private JScrollPane haoyoulan, moshengrenlan, heimingdanlan;

	RoundButton exitRoundButton;

	String nickName;

	byte touxiang;

	// 坐标监听

	private int x = 4, y = 4;

	// 头像资料部分

	JButton touxiangJButton;

	QqClientZiliao qqClientZiliao;

	// 查找 和 退出 按钮

	JButton findJButton, exitJButton, hideJButton;

	// 最小化托盘

	JButton jb;

	TrayIcon trayIcon;

	SystemTray systemTray;



	// 刷新方法

	// 昵称和号码刷新

	public void flushNick(String nickName) {

		Font f = new Font("SansSerif", Font.BOLD, 16);

		nickNameJLabel.setText(nickName);

		nickNameJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameJLabel);

		nickNameJLabel.setBounds(153, 10, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushQqNumber(int qqNumber) {

		Font f = new Font("SansSerif", Font.BOLD, 18);



		qqNumberJLabel.setFont(f);

		qqNumberJLabel.setText(qqNumber + " ");

		qqClientFriendsList1.add(qqNumberJLabel);

		qqNumberJLabel.setBounds(153, 45, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushSex(String sex) {

		System.out.println("性别:" + sex);

		Font f = new Font("SansSerif", Font.BOLD, 18);

		sexJLabel.setFont(f);

		sexJLabel.setText(sex);

		qqClientFriendsList1.add(sexJLabel);

		sexJLabel.setBounds(153, 80, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushTouxiang(byte touxiang) {

		if (touxiang == 1) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang1);

			touxiang1.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 2) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang2);

			touxiang2.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 3) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang3);

			touxiang3.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 4) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang4);

			touxiang4.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}



	}



	// 查找在线用户刷新



	public void flushOnlineuser(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);



			qqClientFind04.findList.add(userInfo.getQq() + " "

					+ userInfo.getNickname() + " " + userInfo.getSex());

		}



	}



	// 向列表中添加一个好友

	public void flushAddFriend(int qq, String nickname, byte icon) {

		qqs[count] = qq;

		System.out.println(count);

		System.out.println(MyFriendArrayName[count]);

		MyFriendArrayName[count].setVisible(true);

		MyFriendArrayName[count].setText(nickname);

		MyFriendArray[count].setVisible(true);

		count++;

		System.out.println("头像参数:" + icon);

		if (icon == 1) {

			MyFriendArray[count].setIcon(touxiang1ImageIcon);

		}

		if (icon == 2) {

			MyFriendArray[count].setIcon(touxiang2ImageIcon);

		}

		if (icon == 3) {

			MyFriendArray[count].setIcon(touxiang3ImageIcon);

		}

		if (icon == 4) {

			MyFriendArray[count].setIcon(touxiang4ImageIcon);

		}

		MyFriendArrayName[count].setText(nickname);

	}



	// 刷新好友列表

	public void flushFriendsList(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		count = al.size();

		// 第一步获取好友个数

		for (int i = 0; i < al.size(); i++) {

			UserInfo user = al.get(i);

			MyFriendArray[i].setVisible(true);

			MyFriendArrayName[i].setVisible(true);

			qqs[i] = user.getQq();

		}

		// 第二步给好友赋予头像和昵称

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);

			if (userInfo.getIcon() == 1) {

				MyFriendArray[i].setIcon(touxiang1ImageIcon);

			}

			if (userInfo.getIcon() == 2) {

				MyFriendArray[i].setIcon(touxiang2ImageIcon);

			}

			if (userInfo.getIcon() == 3) {

				MyFriendArray[i].setIcon(touxiang3ImageIcon);

			}

			if (userInfo.getIcon() == 4) {

				MyFriendArray[i].setIcon(touxiang4ImageIcon);

			}

			if(userInfo.getOnLine()==1)

				MyFriendArray[i].setEnabled(false);

			

			MyFriendArrayName[i].setText(userInfo.getNickname());

		}

	}

	// 好友上线或下线刷新

	 public void flushOnlineOffline(int qq,int state){

		 // 遍历

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == qq) {

					num = i;

					break;

				}

			}

		 if(state==MsgType.command_onLine){

			 //上线

				JOptionPane.showMessageDialog(null, qq+"用户已经上线");

	

				MyFriendArray[num].setEnabled(true);

		 }else{

			 //下线

			 JOptionPane.showMessageDialog(null, qq+"用户已经下线");

			 

				MyFriendArray[num].setEnabled(false);

		 }

	 }



	public QqClientFriendsList04() {

		// 初始化

		qqClientFriendsList1 = new JFrame();

		haoyoulan = new JScrollPane();

		moshengrenlan = new JScrollPane();

		heimingdanlan = new JScrollPane();

		touxiangJButton = new JButton(new ImageIcon(

				"image/listJiemian04/touxiang.jpg"));

		qqClientZiliao = new QqClientZiliao();

		findJButton = new JButton(new ImageIcon("image/listJiemian04/find.jpg"));

		exitJButton = new JButton(new ImageIcon("image/listJiemian04/exit.jpg"));

		hideJButton = new JButton(new ImageIcon("image/listJiemian04/hide.jpg"));

		// 设置 字体 大小

		Font f = new Font("SansSerif", Font.BOLD, 16);

		top = new JLabel(new ImageIcon("image/listJiemian04/top.jpg"));

		north = new JLabel(new ImageIcon("image/listJiemian04/up.jpg"));

		south = new JLabel(new ImageIcon("image/listJiemian04/down.jpg"));

		west = new JLabel(new ImageIcon("image/listJiemian04/left.jpg"));

		east = new JLabel(new ImageIcon("image/listJiemian04/right.jpg"));

		haoyou = new JButton(new ImageIcon("image/listJiemian04/haoyou.jpg"));

		moshengren = new JButton(new ImageIcon(

				"image/listJiemian04/moshengren.jpg"));

		moshengren_ = new JButton(new ImageIcon(

				"image/listJiemian04/moshengren_.jpg"));

		heimingdan = new JButton(new ImageIcon(

				"image/listJiemian04/heimingdan.jpg"));

		heimingdan_ = new JButton(new ImageIcon(

				"image/listJiemian04/heimingdan_.jpg"));

		// 最小化托盘功能

		systemTray = SystemTray.getSystemTray();

		try {

			trayIcon = new TrayIcon(ImageIO.read(new File("0.gif")));

			systemTray.add(trayIcon);

			// 设置托盘的图标,0.gif与该类文件同一目录

		} catch (IOException e1) {

			e1.printStackTrace();

		} catch (AWTException e2) {

			e2.printStackTrace();

		}

		// 昵称 账号初始化

		nickNameJLabel = new JLabel();

		qqNumberJLabel = new JLabel();

		sexJLabel = new JLabel();

		nickNameForeJLabel = new JLabel("昵称:");

		qqNumberForeJLabel = new JLabel("账号:");

		sexForeJLabel = new JLabel("性别:");

		// 头像初始化

		touxiang1 = new JButton(new ImageIcon(

				"image/listJiemian04/touxiang1.jpg"));

		touxiang2 = new JButton(new ImageIcon(

				"image/listJiemian04/touxiang2.jpg"));

		touxiang3 = new JButton(new ImageIcon(

				"image/listJiemian04/touxiang3.jpg"));

		touxiang4 = new JButton(new ImageIcon(

				"image/listJiemian04/touxiang4.jpg"));

		// 头像图片初始化

		touxiang1ImageIcon = new ImageIcon("image/loginJiemian/touxiang-1.png");

		touxiang2ImageIcon = new ImageIcon("image/loginJiemian/touxiang-2.png");

		touxiang3ImageIcon = new ImageIcon("image/loginJiemian/touxiang-3.png");

		touxiang4ImageIcon = new ImageIcon("image/loginJiemian/touxiang-4.png");



		// 窗口设置

		Toolkit toolkit = Toolkit.getDefaultToolkit();

		qqClientFriendsList1.setIconImage(toolkit.getImage("1.png"));

		qqClientFriendsList1.setSize(265, 700);

		// qqClientFriendsList1.setLocation(1050, 0);

		qqClientFriendsList1.setUndecorated(true);

		 Drag drag = new Drag(qqClientFriendsList1);



			drag.setDragable();

		qqClientFriendsList1.setVisible(true);

		qqClientFriendsList1.setResizable(false);

		qqClientFriendsList1.setDefaultCloseOperation(EXIT_ON_CLOSE);

		qqClientFriendsList1.setLayout(null);

		qqClientFriendsList1.setTitle("LZChat");

		// 昵称 账号设置

		nickNameForeJLabel.setFont(f);

		qqNumberForeJLabel.setFont(f);

		sexForeJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameForeJLabel);

		nickNameForeJLabel.setBounds(110, 10, 53, 20);

		qqClientFriendsList1.add(qqNumberForeJLabel);

		qqNumberForeJLabel.setBounds(110, 45, 53, 20);

		qqClientFriendsList1.add(sexForeJLabel);

		sexForeJLabel.setBounds(110, 80, 53, 20);



		// 边界加入框架

		qqClientFriendsList1.add(top);

		qqClientFriendsList1.add(north);

		qqClientFriendsList1.add(south);

		qqClientFriendsList1.add(west);

		qqClientFriendsList1.add(east);

		qqClientFriendsList1.add(haoyoulan);

		qqClientFriendsList1.add(moshengrenlan);

		qqClientFriendsList1.add(heimingdanlan);

		// 好友栏

		haoyoulan

				.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

		haoyoulan.setBounds(50, 192, 165, 371);

		haoyoulan.setLayout(null);

		//nickName = "昵称";

		// 头像按钮

		qqClientFriendsList1.add(touxiangJButton);

		touxiangJButton.setBounds(0, 0, 100, 100);

		touxiangJButton.addMouseListener(new MouseAdapter() {

			public void mouseExited(MouseEvent e) {



				QqClientZiliao.qqClientZiliao.setVisible(false);



			}

		});

		// 退出和查找按钮

		qqClientFriendsList1.add(findJButton);

		qqClientFriendsList1.add(exitJButton);

		qqClientFriendsList1.add(hideJButton);



		findJButton.setBounds(205, 50, 60, 50);

		exitJButton.setBounds(205, 0, 60, 50);

		hideJButton.setBounds(215, 100, 50, 45);

		findJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("查找");



				if (locationInt == 0) {

					qqClientFind04 = new QqClientFind04(ownerqq);

					qqClientFind04.setQqClientFindJFrameLeft();

				}

				if (locationInt == 1) {

					qqClientFind04 = new QqClientFind04(ownerqq);

					qqClientFind04.setQqClientFindJFrameRight();

				}



				MsgHead msg = new MsgHead();

				msg.setType(MsgType.command_find);

				msg.setTotalLen(4 + 1 + 4 + 4);

				msg.setDest(MsgType.SERVER_QQ_NUMBER);

				msg.setSrc(ownerqq);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出");

				System.exit(0);

			}

		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				System.out.println("隐藏托盘");

				qqClientFriendsList1.setVisible(false);// 窗口最小化时dispose该窗口

			}

		});



		trayIcon.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				if (e.getClickCount() == 2)

					// 双击托盘窗口再现

					setExtendedState(JFrame.NORMAL);

				qqClientFriendsList1.setVisible(true);

			}

		});

		// 边界位置设定

		top.setBounds(100, 0, 105, 100);

		north.setBounds(50, 100, 165, 45);

		south.setBounds(50, 655, 165, 45);

		west.setBounds(0, 100, 50, 600);

		east.setBounds(215, 145, 50, 555);

		// 按钮加入框架

		qqClientFriendsList1.add(haoyou);

		qqClientFriendsList1.add(moshengren);

		qqClientFriendsList1.add(heimingdan);

		haoyou.setBounds(50, 145, 165, 48);

		moshengren.setBounds(50, 562, 165, 48);

		heimingdan.setBounds(50, 607, 165, 48);

		//

		addMouseListener(this);

		addMouseMotionListener(this);



		// 初始化好友



		MyFriend1 = new JButton(new ImageIcon("image/touxiang/102-40.png"));

		MyFriend1Name = new JLabel(nickName);

		haoyoulan.add(MyFriend1Name);

		MyFriend1Name.setFont(f);

		MyFriend1Name.setBounds(44, 0, 44, 44);

		haoyoulan.add(MyFriend1);

		MyFriend1.setBounds(0, 0, 44, 44);



		MyFriend2 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend2Name = new JLabel(nickName);

		haoyoulan.add(MyFriend2Name);

		MyFriend2Name.setFont(f);

		MyFriend2Name.setBounds(44, 44, 44, 44);

		haoyoulan.add(MyFriend2);

		MyFriend2.setBounds(0, 44, 44, 44);



		MyFriend3 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend3Name = new JLabel(nickName);

		haoyoulan.add(MyFriend3Name);

		MyFriend3Name.setFont(f);

		MyFriend3Name.setBounds(44, 88, 44, 44);

		haoyoulan.add(MyFriend3);

		MyFriend3.setBounds(0, 88, 44, 44);



		MyFriend4 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend4Name = new JLabel(nickName);

		haoyoulan.add(MyFriend4Name);

		MyFriend4Name.setFont(f);

		MyFriend4Name.setBounds(44, 132, 44, 44);

		haoyoulan.add(MyFriend4);

		MyFriend4.setBounds(0, 132, 44, 44);



		MyFriend5 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend5Name = new JLabel(nickName);

		haoyoulan.add(MyFriend5Name);

		MyFriend5Name.setFont(f);

		MyFriend5Name.setBounds(44, 176, 44, 44);

		haoyoulan.add(MyFriend5);

		MyFriend5.setBounds(0, 176, 44, 44);



		MyFriend6 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend6Name = new JLabel(nickName);

		haoyoulan.add(MyFriend6Name);

		MyFriend6Name.setFont(f);

		MyFriend6Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend6);

		MyFriend6.setBounds(0, 220, 44, 44);



		MyFriend7 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend7Name = new JLabel(nickName);

		haoyoulan.add(MyFriend7Name);

		MyFriend7Name.setFont(f);

		MyFriend7Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend7);

		MyFriend7.setBounds(0, 220, 44, 44);



		MyFriend8 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend8Name = new JLabel(nickName);

		haoyoulan.add(MyFriend8Name);

		MyFriend8Name.setFont(f);

		MyFriend8Name.setBounds(44, 264, 44, 44);

		haoyoulan.add(MyFriend8);

		MyFriend8.setBounds(0, 264, 44, 44);



		MyFriend9 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend9Name = new JLabel(nickName);

		haoyoulan.add(MyFriend9Name);

		MyFriend9Name.setFont(f);

		MyFriend9Name.setBounds(44, 308, 44, 44);

		haoyoulan.add(MyFriend9);

		MyFriend9.setBounds(0, 308, 44, 44);

		//



		// 开始的时候全部设为不可视

		MyFriend1.setVisible(false);

		MyFriend2.setVisible(false);

		MyFriend3.setVisible(false);

		MyFriend4.setVisible(false);

		MyFriend5.setVisible(false);

		MyFriend6.setVisible(false);

		MyFriend7.setVisible(false);

		MyFriend8.setVisible(false);

		MyFriend9.setVisible(false);

		MyFriend1Name.setVisible(false);

		MyFriend2Name.setVisible(false);

		MyFriend3Name.setVisible(false);

		MyFriend4Name.setVisible(false);

		MyFriend5Name.setVisible(false);

		MyFriend6Name.setVisible(false);

		MyFriend7Name.setVisible(false);

		MyFriend8Name.setVisible(false);

		MyFriend9Name.setVisible(false);



		MyFriendArray = new JButton[] { MyFriend1, MyFriend2, MyFriend3,

				MyFriend4, MyFriend5, MyFriend6, MyFriend7, MyFriend8,

				MyFriend9 };

		MyFriendArrayName = new JLabel[] { MyFriend1Name, MyFriend2Name,

				MyFriend3Name, MyFriend4Name, MyFriend5Name, MyFriend6Name,

				MyFriend7Name, MyFriend8Name, MyFriend9Name };

		// 好友按钮监听

		MyFriend1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(1);

			}

		});

		MyFriend2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(2);

			}

		});

		MyFriend3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(3);

			}

		});

		MyFriend4.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(4);

			}

		});

		MyFriend5.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(5);

			}

		});

		MyFriend6.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(6);

			}

		});

		MyFriend7.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(7);

			}

		});

		MyFriend8.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(8);

			}

		});

		MyFriend9.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(9);

			}

		});



		moshengren1 = new JButton(new ImageIcon("image/touxiang/149-40.png"));

		moshengren1Name = new JLabel("小北");

		moshengren1Name.setFont(f);

		moshengrenlan.add(moshengren1);

		moshengrenlan.add(moshengren1Name);

		moshengrenlan.setLayout(null);

		moshengren1.setBounds(0, 0, 44, 44);

		moshengren1Name.setBounds(44, 0, 44, 44);



		heimingdan1 = new JButton(new ImageIcon("image/touxiang/150-40.png"));

		heimingdan1Name = new JLabel("小南");

		heimingdan1Name.setFont(f);

		heimingdanlan.add(heimingdan1);

		heimingdanlan.add(heimingdan1Name);

		heimingdanlan.setLayout(null);

		heimingdan1.setBounds(0, 0, 44, 44);

		heimingdan1Name.setBounds(44, 0, 44, 44);

		// 好友栏 陌生人栏 黑名单栏 切换设计

		// 规定 当"moshengren1"时陌生人按钮在下面 当"heimingdan1"时黑名单按钮在下面

		// 当"moshengren2"时陌生人按钮在上面 当"heimingdan2"时黑名单按钮在上面

		moshengren.setName("moshengren1");

		heimingdan.setName("heimingdan1");

		haoyou.addMouseListener(new MouseAdapter() {



		});

		moshengren.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren1")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);

					moshengren.setName("moshengren2");

					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 371);

					qqClientFriendsList1.repaint();

				}



			}



		});

		moshengren_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren2")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 191, 165, 370);

					qqClientFriendsList1.repaint();



				} else {

					qqClientFriendsList1.add(moshengren);



					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");

					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 192, 165, 369);

					qqClientFriendsList1.repaint();

				}



			}



		});

		heimingdan.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					moshengren.setName("moshengren2");



					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 369);

					qqClientFriendsList1.repaint();

				} else if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 370);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					qqClientFriendsList1.repaint();



				}

			}



		});

		heimingdan_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan2")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 370);

					qqClientFriendsList1.repaint();

				}



			}



		});



		// 获得当前鼠标坐标

		qqClientFriendsList1.addMouseMotionListener(new MouseAdapter() {

			public void mouseMoved(MouseEvent e) {

				x = e.getX();

				y = e.getY();

				System.out.println("当前X坐标是:" + x + " Y坐标是:" + y);



			}



		});

		// 判断边界窗口消失

		// qqClientFriendsList1.addMouseListener(new MouseAdapter() {

		// public void mouseExited(MouseEvent e) {

		// System.out.println("离开时X、Y坐标是:" + x + " " + y);

		// if (x > 260 || y > 645 || x < 5) {

		// qqClientFriendsList1.setVisible(false);

		// new QqClientFriendsListX04();

		//

		//

		// }

		//

		// }

		//

		// });

		//



	}



	public void chat(int i) {

		QqClientFriendsChat04 qqchat = new QqClientFriendsChat04(ownerqq,

				MyFriendArrayName[i-1].getText(), qqs[i - 1]);

		String str = ownerqq + " " + qqs[i - 1];

		System.out.println(str);

		chats.put(str, qqchat);

	}



	public static void main(String[] args) {

		new QqClientFriendsList04();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseDragged(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseMoved(MouseEvent e) {



		// TODO Auto-generated method stub



	}



	public void dealMsg(MsgHead msg) {

		if (msg.getType() == MsgType.command_perdata) {

			MsgPerData mpd = (MsgPerData) msg;

			// mpd.getDest();

			// mpd.getIcon();

			// mpd.getSex();

			// mpd.getNickname();

			// 刷新界面

			ownerqq = mpd.getDest();

			flushNick(mpd.getNickname());

			flushQqNumber(mpd.getDest());

			flushTouxiang(mpd.getIcon());

			flushSex(mpd.getSex());



		} else if (msg.getType() == MsgType.command_teamList) {

			MsgTeamList mtl = (MsgTeamList) msg;

			ArrayList<TeamInfo> teams = mtl.getTeamList();

			// for (TeamInfo teamInfo : teams) {

			TeamInfo teamInfo = teams.get(0);

			ArrayList<UserInfo> users = teamInfo.getFriendList();

			for (UserInfo userInfo : users) {

				// 可以得到的数据

				userInfo.getQq();

				userInfo.getNickname();

				userInfo.getIcon();

				userInfo.getOnLine();

				userInfo.getSex();

				userInfo.getOnLine();

				// 刷新界面

				flushFriendsList(users);

			}



		} else if (msg.getType() == MsgType.command_find_resp) {

			MsgFindResp mfr = (MsgFindResp) msg;

			ArrayList<UserInfo> users = mfr.getUsers();

			// qqClientFind04的刷新方法

			flushOnlineuser(users);

		} else if (msg.getType() == MsgType.command_addFriend_Resp) {

			MsgAddFriendResp mafr = (MsgAddFriendResp) msg;

			if (mafr.getState() == 0) {

				flushAddFriend(mafr.getQq(), mafr.getNickName(), mafr.getIcon());

			} else {

				JOptionPane.showMessageDialog(null, mafr.getSrc()

						+ " 拒接你的添加好友请求!");

			}



		} else if (msg.getType() == MsgType.command_onLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_onLine);

		} else if (msg.getType() == MsgType.command_offLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_offLine);

		} else if (msg.getType() == MsgType.command_chatText) {

			MsgChatText mct = (MsgChatText) msg;

			String key = mct.getDest()+" "+mct.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == mct.getSrc()) {

					num = i;

					break;

				}

			}

			

			//System.out.println("MyFriendArrayName[num].getText()"+MyFriendArrayName[num].getText()+" num:"+num+" key:"+key);

			

			qqClientFriendsChat04 = chats.get(key);

			if (qqClientFriendsChat04 == null) {

				qqClientFriendsChat04 = new QqClientFriendsChat04(ownerqq,

						MyFriendArrayName[num].getText(), mct.getSrc());

				chats.put(key, qqClientFriendsChat04);

			}



			qqClientFriendsChat04.flushFriendMsg(mct.getTime(),mct.getContent(),

					MyFriendArrayName[num].getText() );

		} else if (msg.getType() == MsgType.command_addYou) {

			MsgAddYou may = (MsgAddYou) msg;

			may.getSex();

			may.getNote();

			may.getNickname();

			may.getSrc();

			// 弹出界面

			new QqClientAcceptFriends04(ownerqq).flushAccept(may.getSrc(),

					may.getNickname(), may.getNote());

		}else if(msg.getType() == MsgType.command_vibration){

			String key = msg.getDest()+" "+msg.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == msg.getSrc()) {

					num = i;

					break;

				}

			}

			qqClientFriendsChat04 = chats.get(key);

			if (qqClientFriendsChat04 == null) {

				qqClientFriendsChat04 = new QqClientFriendsChat04(ownerqq,

						MyFriendArrayName[num].getText(), msg.getSrc());

				chats.put(key, qqClientFriendsChat04);

			}

			//震动窗口

			qqClientFriendsChat04.Vibration();

		}

	}



}

 

package view;



// Qq主窗口

import java.awt.AWTException;

import java.awt.Font;

import java.awt.SystemTray;

import java.awt.Toolkit;

import java.awt.TrayIcon;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.event.MouseMotionListener;

import java.io.File;

import java.io.IOException;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;



import javax.imageio.ImageIO;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JScrollPane;

import javax.swing.ScrollPaneConstants;



import model.TeamInfo;

import model.UserInfo;

import msg.MsgAddFriendResp;

import msg.MsgAddYou;

import msg.MsgChatText;

import msg.MsgFindResp;

import msg.MsgHead;

import msg.MsgPerData;

import msg.MsgTeamList;

import msg.MsgType;

import tools.RoundButton;

import client.ClientConServer;

import client.ClientMsgListener;



@SuppressWarnings("serial")

public class QqClientFriendsList03 extends JFrame implements MouseListener,

		MouseMotionListener, ClientMsgListener {

	// 定义各变量

	private ClientConServer ccs = ClientConServer.getCcs();



	private int count = 0;



	private int ownerqq;

	private JFrame qqClientFriendsList1;

	// 聊天界面的map String = "ownerqq otherqq"

	private Map<String, QqClientFriendsChat03> chats = new HashMap<String, QqClientFriendsChat03>();

	private QqClientFind03 qqClientFind03;



	private QqClientFriendsChat03 qqClientFriendsChat03;

	private int locationInt;

	// 从Login传入的 昵称和号码 变成JLabel

	JLabel nickNameJLabel, qqNumberJLabel, sexJLabel;

	// 昵称: 账号:

	JLabel nickNameForeJLabel, qqNumberForeJLabel, sexForeJLabel;

	// 头像

	JButton touxiang1, touxiang2, touxiang3, touxiang4;



	// 选择左边右边方法

	public void setLocationRight() {

		qqClientFriendsList1.setLocation(1050, 0);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFriendsList1.setLocation(0, 0);

		locationInt = 0;

	}



	private JLabel north, south, west, east, top;

	private JButton haoyou, moshengren, heimingdan, moshengren_, heimingdan_;

	// 好友列表部分

	private JLabel MyFriend1Name, MyFriend2Name, MyFriend3Name, MyFriend4Name,

			MyFriend5Name, MyFriend6Name, MyFriend7Name, MyFriend8Name,

			MyFriend9Name, moshengren1Name, heimingdan1Name;



	private JButton MyFriend1, MyFriend2, MyFriend3, MyFriend4, MyFriend5,

			MyFriend6, MyFriend7, MyFriend8, MyFriend9, moshengren1,

			heimingdan1;

	JButton[] MyFriendArray;

	JLabel[] MyFriendArrayName;

	int[] qqs = new int[9];

	// 定义头像图片

	ImageIcon touxiang1ImageIcon, touxiang2ImageIcon, touxiang3ImageIcon,

			touxiang4ImageIcon;

	private JScrollPane haoyoulan, moshengrenlan, heimingdanlan;

	RoundButton exitRoundButton;

	String nickName;

	byte touxiang;

	// 坐标监听

	private int x = 4, y = 4;

	// 头像资料部分

	JButton touxiangJButton;

	QqClientZiliao qqClientZiliao;

	// 查找 和 退出 按钮

	JButton findJButton, exitJButton, hideJButton;

	// 最小化托盘

	JButton jb;

	TrayIcon trayIcon;

	SystemTray systemTray;



	// 刷新方法

	// 昵称和号码刷新

	public void flushNick(String nickName) {

		Font f = new Font("SansSerif", Font.BOLD, 16);

		nickNameJLabel.setText(nickName);

		nickNameJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameJLabel);

		nickNameJLabel.setBounds(153, 10, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushQqNumber(int qqNumber) {

		Font f = new Font("SansSerif", Font.BOLD, 18);



		qqNumberJLabel.setFont(f);

		qqNumberJLabel.setText(qqNumber + " ");

		qqClientFriendsList1.add(qqNumberJLabel);

		qqNumberJLabel.setBounds(153, 45, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushSex(String sex) {

		System.out.println("性别:" + sex);

		Font f = new Font("SansSerif", Font.BOLD, 18);

		sexJLabel.setFont(f);

		sexJLabel.setText(sex);

		qqClientFriendsList1.add(sexJLabel);

		sexJLabel.setBounds(153, 80, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushTouxiang(byte touxiang) {

		if (touxiang == 1) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang1);

			touxiang1.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 2) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang2);

			touxiang2.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 3) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang3);

			touxiang3.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 4) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang4);

			touxiang4.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}



	}



	// 查找在线用户刷新



	public void flushOnlineuser(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);



			qqClientFind03.findList.add(userInfo.getQq() + " "

					+ userInfo.getNickname() + " " + userInfo.getSex());

		}



	}



	// 向列表中添加一个好友

	public void flushAddFriend(int qq, String nickname, byte icon) {

		qqs[count] = qq;

		System.out.println(count);

		System.out.println(MyFriendArrayName[count]);

		MyFriendArrayName[count].setVisible(true);

		MyFriendArrayName[count].setText(nickname);

		MyFriendArray[count].setVisible(true);

		count++;

		System.out.println("头像参数:" + icon);

		if (icon == 1) {

			MyFriendArray[count].setIcon(touxiang1ImageIcon);

		}

		if (icon == 2) {

			MyFriendArray[count].setIcon(touxiang2ImageIcon);

		}

		if (icon == 3) {

			MyFriendArray[count].setIcon(touxiang3ImageIcon);

		}

		if (icon == 4) {

			MyFriendArray[count].setIcon(touxiang4ImageIcon);

		}

		MyFriendArrayName[count].setText(nickname);

	}



	// 刷新好友列表

	public void flushFriendsList(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		count = al.size();

		// 第一步获取好友个数

		for (int i = 0; i < al.size(); i++) {

			UserInfo user = al.get(i);

			MyFriendArray[i].setVisible(true);

			MyFriendArrayName[i].setVisible(true);

			qqs[i] = user.getQq();

		}

		// 第二步给好友赋予头像和昵称

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);

			if (userInfo.getIcon() == 1) {

				MyFriendArray[i].setIcon(touxiang1ImageIcon);

			}

			if (userInfo.getIcon() == 2) {

				MyFriendArray[i].setIcon(touxiang2ImageIcon);

			}

			if (userInfo.getIcon() == 3) {

				MyFriendArray[i].setIcon(touxiang3ImageIcon);

			}

			if (userInfo.getIcon() == 4) {

				MyFriendArray[i].setIcon(touxiang4ImageIcon);

			}

			if(userInfo.getOnLine()==1)

				MyFriendArray[i].setEnabled(false);

			

			MyFriendArrayName[i].setText(userInfo.getNickname());

		}

	}

	// 好友上线或下线刷新

	 public void flushOnlineOffline(int qq,int state){

		 // 遍历

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == qq) {

					num = i;

					break;

				}

			}

		 if(state==MsgType.command_onLine){

			 //上线

				JOptionPane.showMessageDialog(null, qq+"用户已经上线");

	

				MyFriendArray[num].setEnabled(true);

		 }else{

			 //下线

			 JOptionPane.showMessageDialog(null, qq+"用户已经下线");

			 

				MyFriendArray[num].setEnabled(false);

		 }

	 }



	public QqClientFriendsList03() {

		// 初始化

		qqClientFriendsList1 = new JFrame();

		haoyoulan = new JScrollPane();

		moshengrenlan = new JScrollPane();

		heimingdanlan = new JScrollPane();

		touxiangJButton = new JButton(new ImageIcon(

				"image/listJiemian03/touxiang.jpg"));

		qqClientZiliao = new QqClientZiliao();

		findJButton = new JButton(new ImageIcon("image/listJiemian03/find.jpg"));

		exitJButton = new JButton(new ImageIcon("image/listJiemian03/exit.jpg"));

		hideJButton = new JButton(new ImageIcon("image/listJiemian03/hide.jpg"));

		// 设置 字体 大小

		Font f = new Font("SansSerif", Font.BOLD, 16);

		top = new JLabel(new ImageIcon("image/listJiemian03/top.jpg"));

		north = new JLabel(new ImageIcon("image/listJiemian03/up.jpg"));

		south = new JLabel(new ImageIcon("image/listJiemian03/down.jpg"));

		west = new JLabel(new ImageIcon("image/listJiemian03/left.jpg"));

		east = new JLabel(new ImageIcon("image/listJiemian03/right.jpg"));

		haoyou = new JButton(new ImageIcon("image/listJiemian03/haoyou.jpg"));

		moshengren = new JButton(new ImageIcon(

				"image/listJiemian03/moshengren.jpg"));

		moshengren_ = new JButton(new ImageIcon(

				"image/listJiemian03/moshengren_.jpg"));

		heimingdan = new JButton(new ImageIcon(

				"image/listJiemian03/heimingdan.jpg"));

		heimingdan_ = new JButton(new ImageIcon(

				"image/listJiemian03/heimingdan_.jpg"));

		// 最小化托盘功能

		systemTray = SystemTray.getSystemTray();

		try {

			trayIcon = new TrayIcon(ImageIO.read(new File("0.gif")));

			systemTray.add(trayIcon);

			// 设置托盘的图标,0.gif与该类文件同一目录

		} catch (IOException e1) {

			e1.printStackTrace();

		} catch (AWTException e2) {

			e2.printStackTrace();

		}

		// 昵称 账号初始化

		nickNameJLabel = new JLabel();

		qqNumberJLabel = new JLabel();

		sexJLabel = new JLabel();

		nickNameForeJLabel = new JLabel("昵称:");

		qqNumberForeJLabel = new JLabel("账号:");

		sexForeJLabel = new JLabel("性别:");

		// 头像初始化

		touxiang1 = new JButton(new ImageIcon(

				"image/listJiemian03/touxiang1.jpg"));

		touxiang2 = new JButton(new ImageIcon(

				"image/listJiemian03/touxiang2.jpg"));

		touxiang3 = new JButton(new ImageIcon(

				"image/listJiemian03/touxiang3.jpg"));

		touxiang4 = new JButton(new ImageIcon(

				"image/listJiemian03/touxiang4.jpg"));

		// 头像图片初始化

		touxiang1ImageIcon = new ImageIcon("image/loginJiemian/touxiang-1.png");

		touxiang2ImageIcon = new ImageIcon("image/loginJiemian/touxiang-2.png");

		touxiang3ImageIcon = new ImageIcon("image/loginJiemian/touxiang-3.png");

		touxiang4ImageIcon = new ImageIcon("image/loginJiemian/touxiang-4.png");



		// 窗口设置

		Toolkit toolkit = Toolkit.getDefaultToolkit();

		qqClientFriendsList1.setIconImage(toolkit.getImage("1.png"));

		qqClientFriendsList1.setSize(265, 700);

		// qqClientFriendsList1.setLocation(1050, 0);

		qqClientFriendsList1.setUndecorated(true);

		 Drag drag = new Drag(qqClientFriendsList1);



			drag.setDragable();

		qqClientFriendsList1.setVisible(true);

		qqClientFriendsList1.setResizable(false);

		qqClientFriendsList1.setDefaultCloseOperation(EXIT_ON_CLOSE);

		qqClientFriendsList1.setLayout(null);

		qqClientFriendsList1.setTitle("LZChat");

		// 昵称 账号设置

		nickNameForeJLabel.setFont(f);

		qqNumberForeJLabel.setFont(f);

		sexForeJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameForeJLabel);

		nickNameForeJLabel.setBounds(110, 10, 53, 20);

		qqClientFriendsList1.add(qqNumberForeJLabel);

		qqNumberForeJLabel.setBounds(110, 45, 53, 20);

		qqClientFriendsList1.add(sexForeJLabel);

		sexForeJLabel.setBounds(110, 80, 53, 20);



		// 边界加入框架

		qqClientFriendsList1.add(top);

		qqClientFriendsList1.add(north);

		qqClientFriendsList1.add(south);

		qqClientFriendsList1.add(west);

		qqClientFriendsList1.add(east);

		qqClientFriendsList1.add(haoyoulan);

		qqClientFriendsList1.add(moshengrenlan);

		qqClientFriendsList1.add(heimingdanlan);

		// 好友栏

		haoyoulan

				.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

		haoyoulan.setBounds(50, 192, 165, 371);

		haoyoulan.setLayout(null);

		//nickName = "昵称";

		// 头像按钮

		qqClientFriendsList1.add(touxiangJButton);

		touxiangJButton.setBounds(0, 0, 100, 100);

		touxiangJButton.addMouseListener(new MouseAdapter() {

			public void mouseExited(MouseEvent e) {



				QqClientZiliao.qqClientZiliao.setVisible(false);



			}

		});

		// 退出和查找按钮

		qqClientFriendsList1.add(findJButton);

		qqClientFriendsList1.add(exitJButton);

		qqClientFriendsList1.add(hideJButton);



		findJButton.setBounds(205, 50, 60, 50);

		exitJButton.setBounds(205, 0, 60, 50);

		hideJButton.setBounds(215, 100, 50, 45);

		findJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("查找");



				if (locationInt == 0) {

					qqClientFind03 = new QqClientFind03(ownerqq);

					qqClientFind03.setQqClientFindJFrameLeft();

				}

				if (locationInt == 1) {

					qqClientFind03 = new QqClientFind03(ownerqq);

					qqClientFind03.setQqClientFindJFrameRight();

				}



				MsgHead msg = new MsgHead();

				msg.setType(MsgType.command_find);

				msg.setTotalLen(4 + 1 + 4 + 4);

				msg.setDest(MsgType.SERVER_QQ_NUMBER);

				msg.setSrc(ownerqq);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出");

				System.exit(0);

			}

		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				System.out.println("隐藏托盘");

				qqClientFriendsList1.setVisible(false);// 窗口最小化时dispose该窗口

			}

		});



		trayIcon.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				if (e.getClickCount() == 2)

					// 双击托盘窗口再现

					setExtendedState(JFrame.NORMAL);

				qqClientFriendsList1.setVisible(true);

			}

		});

		// 边界位置设定

		top.setBounds(100, 0, 105, 100);

		north.setBounds(50, 100, 165, 45);

		south.setBounds(50, 655, 165, 45);

		west.setBounds(0, 100, 50, 600);

		east.setBounds(215, 145, 50, 555);

		// 按钮加入框架

		qqClientFriendsList1.add(haoyou);

		qqClientFriendsList1.add(moshengren);

		qqClientFriendsList1.add(heimingdan);

		haoyou.setBounds(50, 145, 165, 48);

		moshengren.setBounds(50, 562, 165, 48);

		heimingdan.setBounds(50, 607, 165, 48);

		//

		addMouseListener(this);

		addMouseMotionListener(this);



		// 初始化好友



		MyFriend1 = new JButton(new ImageIcon("image/touxiang/102-40.png"));

		MyFriend1Name = new JLabel(nickName);

		haoyoulan.add(MyFriend1Name);

		MyFriend1Name.setFont(f);

		MyFriend1Name.setBounds(44, 0, 44, 44);

		haoyoulan.add(MyFriend1);

		MyFriend1.setBounds(0, 0, 44, 44);



		MyFriend2 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend2Name = new JLabel(nickName);

		haoyoulan.add(MyFriend2Name);

		MyFriend2Name.setFont(f);

		MyFriend2Name.setBounds(44, 44, 44, 44);

		haoyoulan.add(MyFriend2);

		MyFriend2.setBounds(0, 44, 44, 44);



		MyFriend3 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend3Name = new JLabel(nickName);

		haoyoulan.add(MyFriend3Name);

		MyFriend3Name.setFont(f);

		MyFriend3Name.setBounds(44, 88, 44, 44);

		haoyoulan.add(MyFriend3);

		MyFriend3.setBounds(0, 88, 44, 44);



		MyFriend4 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend4Name = new JLabel(nickName);

		haoyoulan.add(MyFriend4Name);

		MyFriend4Name.setFont(f);

		MyFriend4Name.setBounds(44, 132, 44, 44);

		haoyoulan.add(MyFriend4);

		MyFriend4.setBounds(0, 132, 44, 44);



		MyFriend5 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend5Name = new JLabel(nickName);

		haoyoulan.add(MyFriend5Name);

		MyFriend5Name.setFont(f);

		MyFriend5Name.setBounds(44, 176, 44, 44);

		haoyoulan.add(MyFriend5);

		MyFriend5.setBounds(0, 176, 44, 44);



		MyFriend6 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend6Name = new JLabel(nickName);

		haoyoulan.add(MyFriend6Name);

		MyFriend6Name.setFont(f);

		MyFriend6Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend6);

		MyFriend6.setBounds(0, 220, 44, 44);



		MyFriend7 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend7Name = new JLabel(nickName);

		haoyoulan.add(MyFriend7Name);

		MyFriend7Name.setFont(f);

		MyFriend7Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend7);

		MyFriend7.setBounds(0, 220, 44, 44);



		MyFriend8 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend8Name = new JLabel(nickName);

		haoyoulan.add(MyFriend8Name);

		MyFriend8Name.setFont(f);

		MyFriend8Name.setBounds(44, 264, 44, 44);

		haoyoulan.add(MyFriend8);

		MyFriend8.setBounds(0, 264, 44, 44);



		MyFriend9 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend9Name = new JLabel(nickName);

		haoyoulan.add(MyFriend9Name);

		MyFriend9Name.setFont(f);

		MyFriend9Name.setBounds(44, 308, 44, 44);

		haoyoulan.add(MyFriend9);

		MyFriend9.setBounds(0, 308, 44, 44);

		//



		// 开始的时候全部设为不可视

		MyFriend1.setVisible(false);

		MyFriend2.setVisible(false);

		MyFriend3.setVisible(false);

		MyFriend4.setVisible(false);

		MyFriend5.setVisible(false);

		MyFriend6.setVisible(false);

		MyFriend7.setVisible(false);

		MyFriend8.setVisible(false);

		MyFriend9.setVisible(false);

		MyFriend1Name.setVisible(false);

		MyFriend2Name.setVisible(false);

		MyFriend3Name.setVisible(false);

		MyFriend4Name.setVisible(false);

		MyFriend5Name.setVisible(false);

		MyFriend6Name.setVisible(false);

		MyFriend7Name.setVisible(false);

		MyFriend8Name.setVisible(false);

		MyFriend9Name.setVisible(false);



		MyFriendArray = new JButton[] { MyFriend1, MyFriend2, MyFriend3,

				MyFriend4, MyFriend5, MyFriend6, MyFriend7, MyFriend8,

				MyFriend9 };

		MyFriendArrayName = new JLabel[] { MyFriend1Name, MyFriend2Name,

				MyFriend3Name, MyFriend4Name, MyFriend5Name, MyFriend6Name,

				MyFriend7Name, MyFriend8Name, MyFriend9Name };

		// 好友按钮监听

		MyFriend1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(1);

			}

		});

		MyFriend2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(2);

			}

		});

		MyFriend3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(3);

			}

		});

		MyFriend4.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(4);

			}

		});

		MyFriend5.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(5);

			}

		});

		MyFriend6.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(6);

			}

		});

		MyFriend7.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(7);

			}

		});

		MyFriend8.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(8);

			}

		});

		MyFriend9.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(9);

			}

		});



		moshengren1 = new JButton(new ImageIcon("image/touxiang/149-40.png"));

		moshengren1Name = new JLabel("小北");

		moshengren1Name.setFont(f);

		moshengrenlan.add(moshengren1);

		moshengrenlan.add(moshengren1Name);

		moshengrenlan.setLayout(null);

		moshengren1.setBounds(0, 0, 44, 44);

		moshengren1Name.setBounds(44, 0, 44, 44);



		heimingdan1 = new JButton(new ImageIcon("image/touxiang/150-40.png"));

		heimingdan1Name = new JLabel("小南");

		heimingdan1Name.setFont(f);

		heimingdanlan.add(heimingdan1);

		heimingdanlan.add(heimingdan1Name);

		heimingdanlan.setLayout(null);

		heimingdan1.setBounds(0, 0, 44, 44);

		heimingdan1Name.setBounds(44, 0, 44, 44);

		// 好友栏 陌生人栏 黑名单栏 切换设计

		// 规定 当"moshengren1"时陌生人按钮在下面 当"heimingdan1"时黑名单按钮在下面

		// 当"moshengren2"时陌生人按钮在上面 当"heimingdan2"时黑名单按钮在上面

		moshengren.setName("moshengren1");

		heimingdan.setName("heimingdan1");

		haoyou.addMouseListener(new MouseAdapter() {



		});

		moshengren.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren1")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);

					moshengren.setName("moshengren2");

					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 371);

					qqClientFriendsList1.repaint();

				}



			}



		});

		moshengren_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren2")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 191, 165, 370);

					qqClientFriendsList1.repaint();



				} else {

					qqClientFriendsList1.add(moshengren);



					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");

					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 192, 165, 369);

					qqClientFriendsList1.repaint();

				}



			}



		});

		heimingdan.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					moshengren.setName("moshengren2");



					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 369);

					qqClientFriendsList1.repaint();

				} else if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 370);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					qqClientFriendsList1.repaint();



				}

			}



		});

		heimingdan_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan2")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 370);

					qqClientFriendsList1.repaint();

				}



			}



		});



		// 获得当前鼠标坐标

		qqClientFriendsList1.addMouseMotionListener(new MouseAdapter() {

			public void mouseMoved(MouseEvent e) {

				x = e.getX();

				y = e.getY();

				System.out.println("当前X坐标是:" + x + " Y坐标是:" + y);



			}



		});

		// 判断边界窗口消失

		// qqClientFriendsList1.addMouseListener(new MouseAdapter() {

		// public void mouseExited(MouseEvent e) {

		// System.out.println("离开时X、Y坐标是:" + x + " " + y);

		// if (x > 260 || y > 645 || x < 5) {

		// qqClientFriendsList1.setVisible(false);

		// new QqClientFriendsListX03();

		//

		//

		// }

		//

		// }

		//

		// });

		//



	}



	public void chat(int i) {

		QqClientFriendsChat03 qqchat = new QqClientFriendsChat03(ownerqq,

				MyFriendArrayName[i-1].getText(), qqs[i - 1]);

		String str = ownerqq + " " + qqs[i - 1];

		System.out.println(str);

		chats.put(str, qqchat);

	}



	public static void main(String[] args) {

		new QqClientFriendsList03();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseDragged(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseMoved(MouseEvent e) {



		// TODO Auto-generated method stub



	}



	public void dealMsg(MsgHead msg) {

		if (msg.getType() == MsgType.command_perdata) {

			MsgPerData mpd = (MsgPerData) msg;

			// mpd.getDest();

			// mpd.getIcon();

			// mpd.getSex();

			// mpd.getNickname();

			// 刷新界面

			ownerqq = mpd.getDest();

			flushNick(mpd.getNickname());

			flushQqNumber(mpd.getDest());

			flushTouxiang(mpd.getIcon());

			flushSex(mpd.getSex());



		} else if (msg.getType() == MsgType.command_teamList) {

			MsgTeamList mtl = (MsgTeamList) msg;

			ArrayList<TeamInfo> teams = mtl.getTeamList();

			// for (TeamInfo teamInfo : teams) {

			TeamInfo teamInfo = teams.get(0);

			ArrayList<UserInfo> users = teamInfo.getFriendList();

			for (UserInfo userInfo : users) {

				// 可以得到的数据

				userInfo.getQq();

				userInfo.getNickname();

				userInfo.getIcon();

				userInfo.getOnLine();

				userInfo.getSex();

				userInfo.getOnLine();

				// 刷新界面

				flushFriendsList(users);

			}



		} else if (msg.getType() == MsgType.command_find_resp) {

			MsgFindResp mfr = (MsgFindResp) msg;

			ArrayList<UserInfo> users = mfr.getUsers();

			// qqClientFind03的刷新方法

			flushOnlineuser(users);

		} else if (msg.getType() == MsgType.command_addFriend_Resp) {

			MsgAddFriendResp mafr = (MsgAddFriendResp) msg;

			if (mafr.getState() == 0) {

				flushAddFriend(mafr.getQq(), mafr.getNickName(), mafr.getIcon());

			} else {

				JOptionPane.showMessageDialog(null, mafr.getSrc()

						+ " 拒接你的添加好友请求!");

			}



		} else if (msg.getType() == MsgType.command_onLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_onLine);

		} else if (msg.getType() == MsgType.command_offLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_offLine);

		} else if (msg.getType() == MsgType.command_chatText) {

			MsgChatText mct = (MsgChatText) msg;

			String key = mct.getDest()+" "+mct.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == mct.getSrc()) {

					num = i;

					break;

				}

			}

			

			//System.out.println("MyFriendArrayName[num].getText()"+MyFriendArrayName[num].getText()+" num:"+num+" key:"+key);

			

			qqClientFriendsChat03 = chats.get(key);

			if (qqClientFriendsChat03 == null) {

				qqClientFriendsChat03 = new QqClientFriendsChat03(ownerqq,

						MyFriendArrayName[num].getText(), mct.getSrc());

				chats.put(key, qqClientFriendsChat03);

			}



			qqClientFriendsChat03.flushFriendMsg(mct.getTime(),mct.getContent(),

					MyFriendArrayName[num].getText() );

		} else if (msg.getType() == MsgType.command_addYou) {

			MsgAddYou may = (MsgAddYou) msg;

			may.getSex();

			may.getNote();

			may.getNickname();

			may.getSrc();

			// 弹出界面

			new QqClientAcceptFriends03(ownerqq).flushAccept(may.getSrc(),

					may.getNickname(), may.getNote());

		}else if(msg.getType() == MsgType.command_vibration){

			String key = msg.getDest()+" "+msg.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == msg.getSrc()) {

					num = i;

					break;

				}

			}

			qqClientFriendsChat03 = chats.get(key);

			if (qqClientFriendsChat03 == null) {

				qqClientFriendsChat03 = new QqClientFriendsChat03(ownerqq,

						MyFriendArrayName[num].getText(), msg.getSrc());

				chats.put(key, qqClientFriendsChat03);

			}

			//震动窗口

			qqClientFriendsChat03.Vibration();

		}

	}



}

 

package view;



// Qq主窗口

import java.awt.AWTException;

import java.awt.Font;

import java.awt.SystemTray;

import java.awt.Toolkit;

import java.awt.TrayIcon;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.event.MouseMotionListener;

import java.io.File;

import java.io.IOException;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;



import javax.imageio.ImageIO;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JScrollPane;

import javax.swing.ScrollPaneConstants;



import model.TeamInfo;

import model.UserInfo;

import msg.MsgAddFriendResp;

import msg.MsgAddYou;

import msg.MsgChatText;

import msg.MsgFindResp;

import msg.MsgHead;

import msg.MsgPerData;

import msg.MsgTeamList;

import msg.MsgType;

import tools.RoundButton;

import client.ClientConServer;

import client.ClientMsgListener;



@SuppressWarnings("serial")

public class QqClientFriendsList02 extends JFrame implements MouseListener,

		MouseMotionListener, ClientMsgListener {

	// 定义各变量

	private ClientConServer ccs = ClientConServer.getCcs();



	private int count = 0;



	private int ownerqq;

	private JFrame qqClientFriendsList1;

	// 聊天界面的map String = "ownerqq otherqq"

	private Map<String, QqClientFriendsChat02> chats = new HashMap<String, QqClientFriendsChat02>();

	private QqClientFind02 qqClientFind02;



	private QqClientFriendsChat02 qqClientFriendsChat02;

	private int locationInt;

	// 从Login传入的 昵称和号码 变成JLabel

	JLabel nickNameJLabel, qqNumberJLabel, sexJLabel;

	// 昵称: 账号:

	JLabel nickNameForeJLabel, qqNumberForeJLabel, sexForeJLabel;

	// 头像

	JButton touxiang1, touxiang2, touxiang3, touxiang4;



	// 选择左边右边方法

	public void setLocationRight() {

		qqClientFriendsList1.setLocation(1050, 0);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFriendsList1.setLocation(0, 0);

		locationInt = 0;

	}



	private JLabel north, south, west, east, top;

	private JButton haoyou, moshengren, heimingdan, moshengren_, heimingdan_;

	// 好友列表部分

	private JLabel MyFriend1Name, MyFriend2Name, MyFriend3Name, MyFriend4Name,

			MyFriend5Name, MyFriend6Name, MyFriend7Name, MyFriend8Name,

			MyFriend9Name, moshengren1Name, heimingdan1Name;



	private JButton MyFriend1, MyFriend2, MyFriend3, MyFriend4, MyFriend5,

			MyFriend6, MyFriend7, MyFriend8, MyFriend9, moshengren1,

			heimingdan1;

	JButton[] MyFriendArray;

	JLabel[] MyFriendArrayName;

	int[] qqs = new int[9];

	// 定义头像图片

	ImageIcon touxiang1ImageIcon, touxiang2ImageIcon, touxiang3ImageIcon,

			touxiang4ImageIcon;

	private JScrollPane haoyoulan, moshengrenlan, heimingdanlan;

	RoundButton exitRoundButton;

	String nickName;

	byte touxiang;

	// 坐标监听

	private int x = 4, y = 4;

	// 头像资料部分

	JButton touxiangJButton;

	QqClientZiliao qqClientZiliao;

	// 查找 和 退出 按钮

	JButton findJButton, exitJButton, hideJButton;

	// 最小化托盘

	JButton jb;

	TrayIcon trayIcon;

	SystemTray systemTray;



	// 刷新方法

	// 昵称和号码刷新

	public void flushNick(String nickName) {

		Font f = new Font("SansSerif", Font.BOLD, 16);

		nickNameJLabel.setText(nickName);

		nickNameJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameJLabel);

		nickNameJLabel.setBounds(153, 10, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushQqNumber(int qqNumber) {

		Font f = new Font("SansSerif", Font.BOLD, 18);



		qqNumberJLabel.setFont(f);

		qqNumberJLabel.setText(qqNumber + " ");

		qqClientFriendsList1.add(qqNumberJLabel);

		qqNumberJLabel.setBounds(153, 45, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushSex(String sex) {

		System.out.println("性别:" + sex);

		Font f = new Font("SansSerif", Font.BOLD, 18);

		sexJLabel.setFont(f);

		sexJLabel.setText(sex);

		qqClientFriendsList1.add(sexJLabel);

		sexJLabel.setBounds(153, 80, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushTouxiang(byte touxiang) {

		if (touxiang == 1) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang1);

			touxiang1.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 2) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang2);

			touxiang2.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 3) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang3);

			touxiang3.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 4) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang4);

			touxiang4.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}



	}



	// 查找在线用户刷新



	public void flushOnlineuser(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);



			qqClientFind02.findList.add(userInfo.getQq() + " "

					+ userInfo.getNickname() + " " + userInfo.getSex());

		}



	}



	// 向列表中添加一个好友

	public void flushAddFriend(int qq, String nickname, byte icon) {

		qqs[count] = qq;

		System.out.println(count);

		System.out.println(MyFriendArrayName[count]);

		MyFriendArrayName[count].setVisible(true);

		MyFriendArrayName[count].setText(nickname);

		MyFriendArray[count].setVisible(true);

		count++;

		System.out.println("头像参数:" + icon);

		if (icon == 1) {

			MyFriendArray[count].setIcon(touxiang1ImageIcon);

		}

		if (icon == 2) {

			MyFriendArray[count].setIcon(touxiang2ImageIcon);

		}

		if (icon == 3) {

			MyFriendArray[count].setIcon(touxiang3ImageIcon);

		}

		if (icon == 4) {

			MyFriendArray[count].setIcon(touxiang4ImageIcon);

		}

		MyFriendArrayName[count].setText(nickname);

	}



	// 刷新好友列表

	public void flushFriendsList(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		count = al.size();

		// 第一步获取好友个数

		for (int i = 0; i < al.size(); i++) {

			UserInfo user = al.get(i);

			MyFriendArray[i].setVisible(true);

			MyFriendArrayName[i].setVisible(true);

			qqs[i] = user.getQq();

		}

		// 第二步给好友赋予头像和昵称

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);

			if (userInfo.getIcon() == 1) {

				MyFriendArray[i].setIcon(touxiang1ImageIcon);

			}

			if (userInfo.getIcon() == 2) {

				MyFriendArray[i].setIcon(touxiang2ImageIcon);

			}

			if (userInfo.getIcon() == 3) {

				MyFriendArray[i].setIcon(touxiang3ImageIcon);

			}

			if (userInfo.getIcon() == 4) {

				MyFriendArray[i].setIcon(touxiang4ImageIcon);

			}

			if(userInfo.getOnLine()==1)

				MyFriendArray[i].setEnabled(false);

			

			MyFriendArrayName[i].setText(userInfo.getNickname());

		}

	}

	// 好友上线或下线刷新

	 public void flushOnlineOffline(int qq,int state){

		 // 遍历

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == qq) {

					num = i;

					break;

				}

			}

		 if(state==MsgType.command_onLine){

			 //上线

				JOptionPane.showMessageDialog(null, qq+"用户已经上线");

	

				MyFriendArray[num].setEnabled(true);

		 }else{

			 //下线

			 JOptionPane.showMessageDialog(null, qq+"用户已经下线");

			 

				MyFriendArray[num].setEnabled(false);

		 }

	 }



	public QqClientFriendsList02() {

		// 初始化

		qqClientFriendsList1 = new JFrame();

		haoyoulan = new JScrollPane();

		moshengrenlan = new JScrollPane();

		heimingdanlan = new JScrollPane();

		touxiangJButton = new JButton(new ImageIcon(

				"image/listJiemian02/touxiang.jpg"));

		qqClientZiliao = new QqClientZiliao();

		findJButton = new JButton(new ImageIcon("image/listJiemian02/find.jpg"));

		exitJButton = new JButton(new ImageIcon("image/listJiemian02/exit.jpg"));

		hideJButton = new JButton(new ImageIcon("image/listJiemian02/hide.jpg"));

		// 设置 字体 大小

		Font f = new Font("SansSerif", Font.BOLD, 16);

		top = new JLabel(new ImageIcon("image/listJiemian02/top.jpg"));

		north = new JLabel(new ImageIcon("image/listJiemian02/up.jpg"));

		south = new JLabel(new ImageIcon("image/listJiemian02/down.jpg"));

		west = new JLabel(new ImageIcon("image/listJiemian02/left.jpg"));

		east = new JLabel(new ImageIcon("image/listJiemian02/right.jpg"));

		haoyou = new JButton(new ImageIcon("image/listJiemian02/haoyou.jpg"));

		moshengren = new JButton(new ImageIcon(

				"image/listJiemian02/moshengren.jpg"));

		moshengren_ = new JButton(new ImageIcon(

				"image/listJiemian02/moshengren_.jpg"));

		heimingdan = new JButton(new ImageIcon(

				"image/listJiemian02/heimingdan.jpg"));

		heimingdan_ = new JButton(new ImageIcon(

				"image/listJiemian02/heimingdan_.jpg"));

		// 最小化托盘功能

		systemTray = SystemTray.getSystemTray();

		try {

			trayIcon = new TrayIcon(ImageIO.read(new File("0.gif")));

			systemTray.add(trayIcon);

			// 设置托盘的图标,0.gif与该类文件同一目录

		} catch (IOException e1) {

			e1.printStackTrace();

		} catch (AWTException e2) {

			e2.printStackTrace();

		}

		// 昵称 账号初始化

		nickNameJLabel = new JLabel();

		qqNumberJLabel = new JLabel();

		sexJLabel = new JLabel();

		nickNameForeJLabel = new JLabel("昵称:");

		qqNumberForeJLabel = new JLabel("账号:");

		sexForeJLabel = new JLabel("性别:");

		// 头像初始化

		touxiang1 = new JButton(new ImageIcon(

				"image/listJiemian02/touxiang1.jpg"));

		touxiang2 = new JButton(new ImageIcon(

				"image/listJiemian02/touxiang2.jpg"));

		touxiang3 = new JButton(new ImageIcon(

				"image/listJiemian02/touxiang3.jpg"));

		touxiang4 = new JButton(new ImageIcon(

				"image/listJiemian02/touxiang4.jpg"));

		// 头像图片初始化

		touxiang1ImageIcon = new ImageIcon("image/loginJiemian/touxiang-1.png");

		touxiang2ImageIcon = new ImageIcon("image/loginJiemian/touxiang-2.png");

		touxiang3ImageIcon = new ImageIcon("image/loginJiemian/touxiang-3.png");

		touxiang4ImageIcon = new ImageIcon("image/loginJiemian/touxiang-4.png");



		// 窗口设置

		Toolkit toolkit = Toolkit.getDefaultToolkit();

		qqClientFriendsList1.setIconImage(toolkit.getImage("1.png"));

		qqClientFriendsList1.setSize(265, 700);

		// qqClientFriendsList1.setLocation(1050, 0);

		qqClientFriendsList1.setUndecorated(true);

		 Drag drag = new Drag(qqClientFriendsList1);



			drag.setDragable();

		qqClientFriendsList1.setVisible(true);

		qqClientFriendsList1.setResizable(false);

		qqClientFriendsList1.setDefaultCloseOperation(EXIT_ON_CLOSE);

		qqClientFriendsList1.setLayout(null);

		qqClientFriendsList1.setTitle("LZChat");

		// 昵称 账号设置

		nickNameForeJLabel.setFont(f);

		qqNumberForeJLabel.setFont(f);

		sexForeJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameForeJLabel);

		nickNameForeJLabel.setBounds(110, 10, 53, 20);

		qqClientFriendsList1.add(qqNumberForeJLabel);

		qqNumberForeJLabel.setBounds(110, 45, 53, 20);

		qqClientFriendsList1.add(sexForeJLabel);

		sexForeJLabel.setBounds(110, 80, 53, 20);



		// 边界加入框架

		qqClientFriendsList1.add(top);

		qqClientFriendsList1.add(north);

		qqClientFriendsList1.add(south);

		qqClientFriendsList1.add(west);

		qqClientFriendsList1.add(east);

		qqClientFriendsList1.add(haoyoulan);

		qqClientFriendsList1.add(moshengrenlan);

		qqClientFriendsList1.add(heimingdanlan);

		// 好友栏

		haoyoulan

				.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

		haoyoulan.setBounds(50, 192, 165, 371);

		haoyoulan.setLayout(null);

		//nickName = "昵称";

		// 头像按钮

		qqClientFriendsList1.add(touxiangJButton);

		touxiangJButton.setBounds(0, 0, 100, 100);

		touxiangJButton.addMouseListener(new MouseAdapter() {

			public void mouseExited(MouseEvent e) {



				QqClientZiliao.qqClientZiliao.setVisible(false);



			}

		});

		// 退出和查找按钮

		qqClientFriendsList1.add(findJButton);

		qqClientFriendsList1.add(exitJButton);

		qqClientFriendsList1.add(hideJButton);



		findJButton.setBounds(205, 50, 60, 50);

		exitJButton.setBounds(205, 0, 60, 50);

		hideJButton.setBounds(215, 100, 50, 45);

		findJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("查找");



				if (locationInt == 0) {

					qqClientFind02 = new QqClientFind02(ownerqq);

					qqClientFind02.setQqClientFindJFrameLeft();

				}

				if (locationInt == 1) {

					qqClientFind02 = new QqClientFind02(ownerqq);

					qqClientFind02.setQqClientFindJFrameRight();

				}



				MsgHead msg = new MsgHead();

				msg.setType(MsgType.command_find);

				msg.setTotalLen(4 + 1 + 4 + 4);

				msg.setDest(MsgType.SERVER_QQ_NUMBER);

				msg.setSrc(ownerqq);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出");

				System.exit(0);

			}

		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				System.out.println("隐藏托盘");

				qqClientFriendsList1.setVisible(false);// 窗口最小化时dispose该窗口

			}

		});



		trayIcon.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				if (e.getClickCount() == 2)

					// 双击托盘窗口再现

					setExtendedState(JFrame.NORMAL);

				qqClientFriendsList1.setVisible(true);

			}

		});

		// 边界位置设定

		top.setBounds(100, 0, 105, 100);

		north.setBounds(50, 100, 165, 45);

		south.setBounds(50, 655, 165, 45);

		west.setBounds(0, 100, 50, 600);

		east.setBounds(215, 145, 50, 555);

		// 按钮加入框架

		qqClientFriendsList1.add(haoyou);

		qqClientFriendsList1.add(moshengren);

		qqClientFriendsList1.add(heimingdan);

		haoyou.setBounds(50, 145, 165, 48);

		moshengren.setBounds(50, 562, 165, 48);

		heimingdan.setBounds(50, 607, 165, 48);

		//

		addMouseListener(this);

		addMouseMotionListener(this);



		// 初始化好友



		MyFriend1 = new JButton(new ImageIcon("image/touxiang/102-40.png"));

		MyFriend1Name = new JLabel(nickName);

		haoyoulan.add(MyFriend1Name);

		MyFriend1Name.setFont(f);

		MyFriend1Name.setBounds(44, 0, 44, 44);

		haoyoulan.add(MyFriend1);

		MyFriend1.setBounds(0, 0, 44, 44);



		MyFriend2 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend2Name = new JLabel(nickName);

		haoyoulan.add(MyFriend2Name);

		MyFriend2Name.setFont(f);

		MyFriend2Name.setBounds(44, 44, 44, 44);

		haoyoulan.add(MyFriend2);

		MyFriend2.setBounds(0, 44, 44, 44);



		MyFriend3 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend3Name = new JLabel(nickName);

		haoyoulan.add(MyFriend3Name);

		MyFriend3Name.setFont(f);

		MyFriend3Name.setBounds(44, 88, 44, 44);

		haoyoulan.add(MyFriend3);

		MyFriend3.setBounds(0, 88, 44, 44);



		MyFriend4 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend4Name = new JLabel(nickName);

		haoyoulan.add(MyFriend4Name);

		MyFriend4Name.setFont(f);

		MyFriend4Name.setBounds(44, 132, 44, 44);

		haoyoulan.add(MyFriend4);

		MyFriend4.setBounds(0, 132, 44, 44);



		MyFriend5 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend5Name = new JLabel(nickName);

		haoyoulan.add(MyFriend5Name);

		MyFriend5Name.setFont(f);

		MyFriend5Name.setBounds(44, 176, 44, 44);

		haoyoulan.add(MyFriend5);

		MyFriend5.setBounds(0, 176, 44, 44);



		MyFriend6 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend6Name = new JLabel(nickName);

		haoyoulan.add(MyFriend6Name);

		MyFriend6Name.setFont(f);

		MyFriend6Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend6);

		MyFriend6.setBounds(0, 220, 44, 44);



		MyFriend7 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend7Name = new JLabel(nickName);

		haoyoulan.add(MyFriend7Name);

		MyFriend7Name.setFont(f);

		MyFriend7Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend7);

		MyFriend7.setBounds(0, 220, 44, 44);



		MyFriend8 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend8Name = new JLabel(nickName);

		haoyoulan.add(MyFriend8Name);

		MyFriend8Name.setFont(f);

		MyFriend8Name.setBounds(44, 264, 44, 44);

		haoyoulan.add(MyFriend8);

		MyFriend8.setBounds(0, 264, 44, 44);



		MyFriend9 = new JButton(new ImageIcon("image/touxiang/148-40.png"));

		MyFriend9Name = new JLabel(nickName);

		haoyoulan.add(MyFriend9Name);

		MyFriend9Name.setFont(f);

		MyFriend9Name.setBounds(44, 308, 44, 44);

		haoyoulan.add(MyFriend9);

		MyFriend9.setBounds(0, 308, 44, 44);

		//



		// 开始的时候全部设为不可视

		MyFriend1.setVisible(false);

		MyFriend2.setVisible(false);

		MyFriend3.setVisible(false);

		MyFriend4.setVisible(false);

		MyFriend5.setVisible(false);

		MyFriend6.setVisible(false);

		MyFriend7.setVisible(false);

		MyFriend8.setVisible(false);

		MyFriend9.setVisible(false);

		MyFriend1Name.setVisible(false);

		MyFriend2Name.setVisible(false);

		MyFriend3Name.setVisible(false);

		MyFriend4Name.setVisible(false);

		MyFriend5Name.setVisible(false);

		MyFriend6Name.setVisible(false);

		MyFriend7Name.setVisible(false);

		MyFriend8Name.setVisible(false);

		MyFriend9Name.setVisible(false);



		MyFriendArray = new JButton[] { MyFriend1, MyFriend2, MyFriend3,

				MyFriend4, MyFriend5, MyFriend6, MyFriend7, MyFriend8,

				MyFriend9 };

		MyFriendArrayName = new JLabel[] { MyFriend1Name, MyFriend2Name,

				MyFriend3Name, MyFriend4Name, MyFriend5Name, MyFriend6Name,

				MyFriend7Name, MyFriend8Name, MyFriend9Name };

		// 好友按钮监听

		MyFriend1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(1);

			}

		});

		MyFriend2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(2);

			}

		});

		MyFriend3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(3);

			}

		});

		MyFriend4.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(4);

			}

		});

		MyFriend5.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(5);

			}

		});

		MyFriend6.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(6);

			}

		});

		MyFriend7.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(7);

			}

		});

		MyFriend8.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(8);

			}

		});

		MyFriend9.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(9);

			}

		});



		moshengren1 = new JButton(new ImageIcon("image/touxiang/149-40.png"));

		moshengren1Name = new JLabel("小北");

		moshengren1Name.setFont(f);

		moshengrenlan.add(moshengren1);

		moshengrenlan.add(moshengren1Name);

		moshengrenlan.setLayout(null);

		moshengren1.setBounds(0, 0, 44, 44);

		moshengren1Name.setBounds(44, 0, 44, 44);



		heimingdan1 = new JButton(new ImageIcon("image/touxiang/150-40.png"));

		heimingdan1Name = new JLabel("小南");

		heimingdan1Name.setFont(f);

		heimingdanlan.add(heimingdan1);

		heimingdanlan.add(heimingdan1Name);

		heimingdanlan.setLayout(null);

		heimingdan1.setBounds(0, 0, 44, 44);

		heimingdan1Name.setBounds(44, 0, 44, 44);

		// 好友栏 陌生人栏 黑名单栏 切换设计

		// 规定 当"moshengren1"时陌生人按钮在下面 当"heimingdan1"时黑名单按钮在下面

		// 当"moshengren2"时陌生人按钮在上面 当"heimingdan2"时黑名单按钮在上面

		moshengren.setName("moshengren1");

		heimingdan.setName("heimingdan1");

		haoyou.addMouseListener(new MouseAdapter() {



		});

		moshengren.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren1")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);

					moshengren.setName("moshengren2");

					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 371);

					qqClientFriendsList1.repaint();

				}



			}



		});

		moshengren_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren2")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 191, 165, 370);

					qqClientFriendsList1.repaint();



				} else {

					qqClientFriendsList1.add(moshengren);



					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");

					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 192, 165, 369);

					qqClientFriendsList1.repaint();

				}



			}



		});

		heimingdan.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					moshengren.setName("moshengren2");



					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 369);

					qqClientFriendsList1.repaint();

				} else if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 370);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					qqClientFriendsList1.repaint();



				}

			}



		});

		heimingdan_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan2")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 370);

					qqClientFriendsList1.repaint();

				}



			}



		});



		// 获得当前鼠标坐标

		qqClientFriendsList1.addMouseMotionListener(new MouseAdapter() {

			public void mouseMoved(MouseEvent e) {

				x = e.getX();

				y = e.getY();

				System.out.println("当前X坐标是:" + x + " Y坐标是:" + y);



			}



		});

		// 判断边界窗口消失

		// qqClientFriendsList1.addMouseListener(new MouseAdapter() {

		// public void mouseExited(MouseEvent e) {

		// System.out.println("离开时X、Y坐标是:" + x + " " + y);

		// if (x > 260 || y > 645 || x < 5) {

		// qqClientFriendsList1.setVisible(false);

		// new QqClientFriendsListX02();

		//

		//

		// }

		//

		// }

		//

		// });

		//



	}



	public void chat(int i) {

		QqClientFriendsChat02 qqchat = new QqClientFriendsChat02(ownerqq,

				MyFriendArrayName[i-1].getText(), qqs[i - 1]);

		String str = ownerqq + " " + qqs[i - 1];

		System.out.println(str);

		chats.put(str, qqchat);

	}



	public static void main(String[] args) {

		new QqClientFriendsList02();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseDragged(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseMoved(MouseEvent e) {



		// TODO Auto-generated method stub



	}



	public void dealMsg(MsgHead msg) {

		if (msg.getType() == MsgType.command_perdata) {

			MsgPerData mpd = (MsgPerData) msg;

			// mpd.getDest();

			// mpd.getIcon();

			// mpd.getSex();

			// mpd.getNickname();

			// 刷新界面

			ownerqq = mpd.getDest();

			flushNick(mpd.getNickname());

			flushQqNumber(mpd.getDest());

			flushTouxiang(mpd.getIcon());

			flushSex(mpd.getSex());



		} else if (msg.getType() == MsgType.command_teamList) {

			MsgTeamList mtl = (MsgTeamList) msg;

			ArrayList<TeamInfo> teams = mtl.getTeamList();

			// for (TeamInfo teamInfo : teams) {

			TeamInfo teamInfo = teams.get(0);

			ArrayList<UserInfo> users = teamInfo.getFriendList();

			for (UserInfo userInfo : users) {

				// 可以得到的数据

				userInfo.getQq();

				userInfo.getNickname();

				userInfo.getIcon();

				userInfo.getOnLine();

				userInfo.getSex();

				userInfo.getOnLine();

				// 刷新界面

				flushFriendsList(users);

			}



		} else if (msg.getType() == MsgType.command_find_resp) {

			MsgFindResp mfr = (MsgFindResp) msg;

			ArrayList<UserInfo> users = mfr.getUsers();

			// qqClientFind02的刷新方法

			flushOnlineuser(users);

		} else if (msg.getType() == MsgType.command_addFriend_Resp) {

			MsgAddFriendResp mafr = (MsgAddFriendResp) msg;

			if (mafr.getState() == 0) {

				flushAddFriend(mafr.getQq(), mafr.getNickName(), mafr.getIcon());

			} else {

				JOptionPane.showMessageDialog(null, mafr.getSrc()

						+ " 拒接你的添加好友请求!");

			}



		} else if (msg.getType() == MsgType.command_onLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_onLine);

		} else if (msg.getType() == MsgType.command_offLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_offLine);

		} else if (msg.getType() == MsgType.command_chatText) {

			MsgChatText mct = (MsgChatText) msg;

			String key = mct.getDest()+" "+mct.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == mct.getSrc()) {

					num = i;

					break;

				}

			}

			

			//System.out.println("MyFriendArrayName[num].getText()"+MyFriendArrayName[num].getText()+" num:"+num+" key:"+key);

			

			qqClientFriendsChat02 = chats.get(key);

			if (qqClientFriendsChat02 == null) {

				qqClientFriendsChat02 = new QqClientFriendsChat02(ownerqq,

						MyFriendArrayName[num].getText(), mct.getSrc());

				chats.put(key, qqClientFriendsChat02);

			}



			qqClientFriendsChat02.flushFriendMsg(mct.getTime(),mct.getContent(),

					MyFriendArrayName[num].getText() );

		} else if (msg.getType() == MsgType.command_addYou) {

			MsgAddYou may = (MsgAddYou) msg;

			may.getSex();

			may.getNote();

			may.getNickname();

			may.getSrc();

			// 弹出界面

			new QqClientAcceptFriends02(ownerqq).flushAccept(may.getSrc(),

					may.getNickname(), may.getNote());

		}else if(msg.getType() == MsgType.command_vibration){

			String key = msg.getDest()+" "+msg.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == msg.getSrc()) {

					num = i;

					break;

				}

			}

			qqClientFriendsChat02 = chats.get(key);

			if (qqClientFriendsChat02 == null) {

				qqClientFriendsChat02 = new QqClientFriendsChat02(ownerqq,

						MyFriendArrayName[num].getText(), msg.getSrc());

				chats.put(key, qqClientFriendsChat02);

			}

			//震动窗口

			qqClientFriendsChat02.Vibration();

		}

	}



}

 

package view;



// Qq主窗口

import java.awt.AWTException;

import java.awt.Font;

import java.awt.SystemTray;

import java.awt.Toolkit;

import java.awt.TrayIcon;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.event.MouseMotionListener;

import java.io.File;

import java.io.IOException;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;



import javax.imageio.ImageIO;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JScrollPane;

import javax.swing.ScrollPaneConstants;



import model.TeamInfo;

import model.UserInfo;

import msg.MsgAddFriendResp;

import msg.MsgAddYou;

import msg.MsgChatText;

import msg.MsgFindResp;

import msg.MsgHead;

import msg.MsgPerData;

import msg.MsgTeamList;

import msg.MsgType;

import tools.RoundButton;

import client.ClientConServer;

import client.ClientMsgListener;



@SuppressWarnings("serial")

public class QqClientFriendsList01 extends JFrame implements MouseListener,

		MouseMotionListener, ClientMsgListener {

	// 定义各变量

	private ClientConServer ccs = ClientConServer.getCcs();



	private int count = 0;



	private int ownerqq;

	private JFrame qqClientFriendsList1;

	// 聊天界面的map String = "ownerqq otherqq"

	private Map<String, QqClientFriendsChat01> chats = new HashMap<String, QqClientFriendsChat01>();

	private QqClientFind01 qqClientFind01;



	private QqClientFriendsChat01 qqClientFriendsChat01;

	private int locationInt;

	// 从Login传入的 昵称和号码 变成JLabel

	JLabel nickNameJLabel, qqNumberJLabel, sexJLabel;

	// 昵称: 账号:

	JLabel nickNameForeJLabel, qqNumberForeJLabel, sexForeJLabel;

	// 头像

	JButton touxiang1, touxiang2, touxiang3, touxiang4;



	// 选择左边右边方法

	public void setLocationRight() {

		qqClientFriendsList1.setLocation(1050, 0);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFriendsList1.setLocation(0, 0);

		locationInt = 0;

	}



	private JLabel north, south, west, east, top;

	private JButton haoyou, moshengren, heimingdan, moshengren_, heimingdan_;

	// 好友列表部分

	private JLabel MyFriend1Name, MyFriend2Name, MyFriend3Name, MyFriend4Name,

			MyFriend5Name, MyFriend6Name, MyFriend7Name, MyFriend8Name,

			MyFriend9Name, moshengren1Name, heimingdan1Name;



	private JButton MyFriend1, MyFriend2, MyFriend3, MyFriend4, MyFriend5,

			MyFriend6, MyFriend7, MyFriend8, MyFriend9, moshengren1,

			heimingdan1;

	JButton[] MyFriendArray;

	JLabel[] MyFriendArrayName;

	int[] qqs = new int[9];

	// 定义头像图片

	ImageIcon touxiang1ImageIcon, touxiang2ImageIcon, touxiang3ImageIcon,

			touxiang4ImageIcon;

	private JScrollPane haoyoulan, moshengrenlan, heimingdanlan;

	RoundButton exitRoundButton;

	String nickName;

	byte touxiang;

	// 坐标监听

	private int x = 4, y = 4;

	// 头像资料部分

	JButton touxiangJButton;

	QqClientZiliao qqClientZiliao;

	// 查找 和 退出 按钮

	JButton findJButton, exitJButton, hideJButton;

	// 最小化托盘

	JButton jb;

	TrayIcon trayIcon;

	SystemTray systemTray;



	// 刷新方法

	// 昵称和号码刷新

	public void flushNick(String nickName) {

		Font f = new Font("SansSerif", Font.BOLD, 16);

		nickNameJLabel.setText(nickName);

		nickNameJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameJLabel);

		nickNameJLabel.setBounds(153, 10, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushQqNumber(int qqNumber) {

		Font f = new Font("SansSerif", Font.BOLD, 18);



		qqNumberJLabel.setFont(f);

		qqNumberJLabel.setText(qqNumber + " ");

		qqClientFriendsList1.add(qqNumberJLabel);

		qqNumberJLabel.setBounds(153, 45, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushSex(String sex) {

		System.out.println("性别:" + sex);

		Font f = new Font("SansSerif", Font.BOLD, 18);

		sexJLabel.setFont(f);

		sexJLabel.setText(sex);

		qqClientFriendsList1.add(sexJLabel);

		sexJLabel.setBounds(153, 80, 80, 20);

		qqClientFriendsList1.remove(top);

		qqClientFriendsList1.add(top);

		top.setBounds(100, 0, 105, 100);



	}



	public void flushTouxiang(byte touxiang) {

		if (touxiang == 1) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang1);

			touxiang1.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 2) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang2);

			touxiang2.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 3) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang3);

			touxiang3.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}

		if (touxiang == 4) {

			qqClientFriendsList1.remove(touxiangJButton);

			qqClientFriendsList1.add(touxiang4);

			touxiang4.setBounds(0, 0, 100, 100);

			qqClientFriendsList1.repaint();

		}



	}



	// 查找在线用户刷新



	public void flushOnlineuser(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);



			qqClientFind01.findList.add(userInfo.getQq() + " "

					+ userInfo.getNickname() + " " + userInfo.getSex());

		}



	}



	// 向列表中添加一个好友

	public void flushAddFriend(int qq, String nickname, byte icon) {

		qqs[count] = qq;

		System.out.println(count);

		System.out.println(MyFriendArrayName[count]);

		MyFriendArrayName[count].setVisible(true);

		MyFriendArrayName[count].setText(nickname);

		MyFriendArray[count].setVisible(true);

//		count++;

//		System.out.println("头像参数:" + icon);

//		if (icon == 1) {

//			MyFriendArray[count].setIcon(touxiang1ImageIcon);

		    

//		}

//		if (icon == 2) {

//			MyFriendArray[count].setIcon(touxiang2ImageIcon);

//		}

//		if (icon == 3) {

//			MyFriendArray[count].setIcon(touxiang3ImageIcon);

//		}

//		if (icon == 4) {

//			MyFriendArray[count].setIcon(touxiang4ImageIcon);

//		}



	}



	// 刷新好友列表

	public void flushFriendsList(ArrayList<UserInfo> al) {

		UserInfo userInfo;

		count = al.size();

		// 第一步获取好友个数

		for (int i = 0; i < al.size(); i++) {

			UserInfo user = al.get(i);

			MyFriendArray[i].setVisible(true);

			MyFriendArrayName[i].setVisible(true);

			qqs[i] = user.getQq();

		}

		// 第二步给好友赋予头像和昵称

		for (int i = 0; i < al.size(); i++) {

			userInfo = al.get(i);

			if (userInfo.getIcon() == 1) {

				MyFriendArray[i].setIcon(touxiang1ImageIcon);

			}

			if (userInfo.getIcon() == 2) {

				MyFriendArray[i].setIcon(touxiang2ImageIcon);

			}

			if (userInfo.getIcon() == 3) {

				MyFriendArray[i].setIcon(touxiang3ImageIcon);

			}

			if (userInfo.getIcon() == 4) {

				MyFriendArray[i].setIcon(touxiang4ImageIcon);

			}

			if(userInfo.getOnLine()==1)

				MyFriendArray[i].setEnabled(false);

			

			MyFriendArrayName[i].setText(userInfo.getNickname());

		}

	}

	// 好友上线或下线刷新

	 public void flushOnlineOffline(int qq,int state){

		 // 遍历

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == qq) {

					num = i;

					break;

				}

			}

		 if(state==MsgType.command_onLine){

			 //上线

				JOptionPane.showMessageDialog(null, qq+"用户已经上线");

	

				MyFriendArray[num].setEnabled(true);

		 }else{

			 //下线

			 JOptionPane.showMessageDialog(null, qq+"用户已经下线");

			 

				MyFriendArray[num].setEnabled(false);

		 }

	 }



	public QqClientFriendsList01() {

		// 初始化

		qqClientFriendsList1 = new JFrame();

		haoyoulan = new JScrollPane();

		moshengrenlan = new JScrollPane();

		heimingdanlan = new JScrollPane();

		touxiangJButton = new JButton(new ImageIcon(

				"image/listJiemian01/touxiang.jpg"));

		qqClientZiliao = new QqClientZiliao();

		findJButton = new JButton(new ImageIcon("image/listJiemian01/find.jpg"));

		exitJButton = new JButton(new ImageIcon("image/listJiemian01/exit.jpg"));

		hideJButton = new JButton(new ImageIcon("image/listJiemian01/hide.jpg"));

		// 设置 字体 大小

		Font f = new Font("SansSerif", Font.BOLD, 16);

		top = new JLabel(new ImageIcon("image/listJiemian01/top.jpg"));

		north = new JLabel(new ImageIcon("image/listJiemian01/up.jpg"));

		south = new JLabel(new ImageIcon("image/listJiemian01/down.jpg"));

		west = new JLabel(new ImageIcon("image/listJiemian01/left.jpg"));

		east = new JLabel(new ImageIcon("image/listJiemian01/right.jpg"));

		haoyou = new JButton(new ImageIcon("image/listJiemian01/haoyou.jpg"));

		moshengren = new JButton(new ImageIcon(

				"image/listJiemian01/moshengren.jpg"));

		moshengren_ = new JButton(new ImageIcon(

				"image/listJiemian01/moshengren_.jpg"));

		heimingdan = new JButton(new ImageIcon(

				"image/listJiemian01/heimingdan.jpg"));

		heimingdan_ = new JButton(new ImageIcon(

				"image/listJiemian01/heimingdan_.jpg"));

		// 最小化托盘功能

		systemTray = SystemTray.getSystemTray();

		try {

			trayIcon = new TrayIcon(ImageIO.read(new File("0.gif")));

			systemTray.add(trayIcon);

			// 设置托盘的图标,0.gif与该类文件同一目录

		} catch (IOException e1) {

			e1.printStackTrace();

		} catch (AWTException e2) {

			e2.printStackTrace();

		}

		// 昵称 账号初始化

		nickNameJLabel = new JLabel();

		qqNumberJLabel = new JLabel();

		sexJLabel = new JLabel();

		nickNameForeJLabel = new JLabel("昵称:");

		qqNumberForeJLabel = new JLabel("账号:");

		sexForeJLabel = new JLabel("性别:");

		// 头像初始化

		touxiang1 = new JButton(new ImageIcon(

				"image/listJiemian01/touxiang1.jpg"));

		touxiang2 = new JButton(new ImageIcon(

				"image/listJiemian01/touxiang2.jpg"));

		touxiang3 = new JButton(new ImageIcon(

				"image/listJiemian01/touxiang3.jpg"));

		touxiang4 = new JButton(new ImageIcon(

				"image/listJiemian01/touxiang4.jpg"));

		// 头像图片初始化

		touxiang1ImageIcon = new ImageIcon("image/loginJiemian/touxiang-1.png");

		touxiang2ImageIcon = new ImageIcon("image/loginJiemian/touxiang-2.png");

		touxiang3ImageIcon = new ImageIcon("image/loginJiemian/touxiang-3.png");

		touxiang4ImageIcon = new ImageIcon("image/loginJiemian/touxiang-4.png");



		// 窗口设置

		Toolkit toolkit = Toolkit.getDefaultToolkit();

		qqClientFriendsList1.setIconImage(toolkit.getImage("1.png"));

		qqClientFriendsList1.setSize(265, 700);

		// qqClientFriendsList1.setLocation(1050, 0);

		qqClientFriendsList1.setUndecorated(true);

		 Drag drag = new Drag(qqClientFriendsList1);



		drag.setDragable();

		qqClientFriendsList1.setVisible(true);

		qqClientFriendsList1.setResizable(false);

		qqClientFriendsList1.setDefaultCloseOperation(EXIT_ON_CLOSE);

		qqClientFriendsList1.setLayout(null);

		qqClientFriendsList1.setTitle("LZChat");

		// 昵称 账号设置

		nickNameForeJLabel.setFont(f);

		qqNumberForeJLabel.setFont(f);

		sexForeJLabel.setFont(f);

		qqClientFriendsList1.add(nickNameForeJLabel);

		nickNameForeJLabel.setBounds(110, 10, 53, 20);

		qqClientFriendsList1.add(qqNumberForeJLabel);

		qqNumberForeJLabel.setBounds(110, 45, 53, 20);

		qqClientFriendsList1.add(sexForeJLabel);

		sexForeJLabel.setBounds(110, 80, 53, 20);



		// 边界加入框架

		qqClientFriendsList1.add(top);

		qqClientFriendsList1.add(north);

		qqClientFriendsList1.add(south);

		qqClientFriendsList1.add(west);

		qqClientFriendsList1.add(east);

		qqClientFriendsList1.add(haoyoulan);

		qqClientFriendsList1.add(moshengrenlan);

		qqClientFriendsList1.add(heimingdanlan);

		// 好友栏

		haoyoulan

				.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

		haoyoulan.setBounds(50, 192, 165, 371);

		haoyoulan.setLayout(null);

		//nickName = "昵称";

		// 头像按钮

		qqClientFriendsList1.add(touxiangJButton);

		touxiangJButton.setBounds(0, 0, 100, 100);

		touxiangJButton.addMouseListener(new MouseAdapter() {

			public void mouseExited(MouseEvent e) {



				QqClientZiliao.qqClientZiliao.setVisible(false);



			}

		});

		// 退出和查找按钮

		qqClientFriendsList1.add(findJButton);

		qqClientFriendsList1.add(exitJButton);

		qqClientFriendsList1.add(hideJButton);



		findJButton.setBounds(205, 50, 60, 50);

		exitJButton.setBounds(205, 0, 60, 50);

		hideJButton.setBounds(215, 100, 50, 45);

		findJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("查找");

				if(qqClientFind01==null){

					qqClientFind01 = new QqClientFind01(ownerqq);

				}

				if (locationInt == 0) {					

					qqClientFind01.setQqClientFindJFrameLeft();

				}

				if (locationInt == 1) {

					qqClientFind01.setQqClientFindJFrameRight();

				}



				MsgHead msg = new MsgHead();

				msg.setType(MsgType.command_find);

				msg.setTotalLen(4 + 1 + 4 + 4);

				msg.setDest(MsgType.SERVER_QQ_NUMBER);

				msg.setSrc(ownerqq);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出");

				System.exit(0);

			}

		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				System.out.println("隐藏托盘");

				qqClientFriendsList1.setVisible(false);// 窗口最小化时dispose该窗口

			}

		});



		trayIcon.addMouseListener(new MouseAdapter() {

			public void mouseClicked(MouseEvent e) {

				if (e.getClickCount() == 2)

					// 双击托盘窗口再现

					setExtendedState(JFrame.NORMAL);

				qqClientFriendsList1.setVisible(true);

			}

		});

		// 边界位置设定

		top.setBounds(100, 0, 105, 100);

		north.setBounds(50, 100, 165, 45);

		south.setBounds(50, 655, 165, 45);

		west.setBounds(0, 100, 50, 600);

		east.setBounds(215, 145, 50, 555);

		// 按钮加入框架

		qqClientFriendsList1.add(haoyou);

		qqClientFriendsList1.add(moshengren);

		qqClientFriendsList1.add(heimingdan);

		haoyou.setBounds(50, 145, 165, 48);

		moshengren.setBounds(50, 562, 165, 48);

		heimingdan.setBounds(50, 607, 165, 48);

		//

		addMouseListener(this);

		addMouseMotionListener(this);



		// 初始化好友



		MyFriend1 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend1Name = new JLabel(nickName);

		haoyoulan.add(MyFriend1Name);

		MyFriend1Name.setFont(f);

		MyFriend1Name.setBounds(44, 0, 44, 44);

		haoyoulan.add(MyFriend1);

		MyFriend1.setBounds(0, 0, 44, 44);



		MyFriend2 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend2Name = new JLabel(nickName);

		haoyoulan.add(MyFriend2Name);

		MyFriend2Name.setFont(f);

		MyFriend2Name.setBounds(44, 44, 44, 44);

		haoyoulan.add(MyFriend2);

		MyFriend2.setBounds(0, 44, 44, 44);



		MyFriend3 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend3Name = new JLabel(nickName);

		haoyoulan.add(MyFriend3Name);

		MyFriend3Name.setFont(f);

		MyFriend3Name.setBounds(44, 88, 44, 44);

		haoyoulan.add(MyFriend3);

		MyFriend3.setBounds(0, 88, 44, 44);



		MyFriend4 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend4Name = new JLabel(nickName);

		haoyoulan.add(MyFriend4Name);

		MyFriend4Name.setFont(f);

		MyFriend4Name.setBounds(44, 132, 44, 44);

		haoyoulan.add(MyFriend4);

		MyFriend4.setBounds(0, 132, 44, 44);



		MyFriend5 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend5Name = new JLabel(nickName);

		haoyoulan.add(MyFriend5Name);

		MyFriend5Name.setFont(f);

		MyFriend5Name.setBounds(44, 176, 44, 44);

		haoyoulan.add(MyFriend5);

		MyFriend5.setBounds(0, 176, 44, 44);



		MyFriend6 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend6Name = new JLabel(nickName);

		haoyoulan.add(MyFriend6Name);

		MyFriend6Name.setFont(f);

		MyFriend6Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend6);

		MyFriend6.setBounds(0, 220, 44, 44);



		MyFriend7 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend7Name = new JLabel(nickName);

		haoyoulan.add(MyFriend7Name);

		MyFriend7Name.setFont(f);

		MyFriend7Name.setBounds(44, 220, 44, 44);

		haoyoulan.add(MyFriend7);

		MyFriend7.setBounds(0, 220, 44, 44);



		MyFriend8 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend8Name = new JLabel(nickName);

		haoyoulan.add(MyFriend8Name);

		MyFriend8Name.setFont(f);

		MyFriend8Name.setBounds(44, 264, 44, 44);

		haoyoulan.add(MyFriend8);

		MyFriend8.setBounds(0, 264, 44, 44);



		MyFriend9 = new JButton(new ImageIcon("image/loginJiemian/touxiang-1.png"));

		MyFriend9Name = new JLabel(nickName);

		haoyoulan.add(MyFriend9Name);

		MyFriend9Name.setFont(f);

		MyFriend9Name.setBounds(44, 308, 44, 44);

		haoyoulan.add(MyFriend9);

		MyFriend9.setBounds(0, 308, 44, 44);

		//



		// 开始的时候全部设为不可视

		MyFriend1.setVisible(false);

		MyFriend2.setVisible(false);

		MyFriend3.setVisible(false);

		MyFriend4.setVisible(false);

		MyFriend5.setVisible(false);

		MyFriend6.setVisible(false);

		MyFriend7.setVisible(false);

		MyFriend8.setVisible(false);

		MyFriend9.setVisible(false);

		MyFriend1Name.setVisible(false);

		MyFriend2Name.setVisible(false);

		MyFriend3Name.setVisible(false);

		MyFriend4Name.setVisible(false);

		MyFriend5Name.setVisible(false);

		MyFriend6Name.setVisible(false);

		MyFriend7Name.setVisible(false);

		MyFriend8Name.setVisible(false);

		MyFriend9Name.setVisible(false);



		MyFriendArray = new JButton[] { MyFriend1, MyFriend2, MyFriend3,

				MyFriend4, MyFriend5, MyFriend6, MyFriend7, MyFriend8,

				MyFriend9 };

		MyFriendArrayName = new JLabel[] { MyFriend1Name, MyFriend2Name,

				MyFriend3Name, MyFriend4Name, MyFriend5Name, MyFriend6Name,

				MyFriend7Name, MyFriend8Name, MyFriend9Name };

		// 好友按钮监听

		MyFriend1.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(1);

			}

		});

		MyFriend2.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(2);

			}

		});

		MyFriend3.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(3);

			}

		});

		MyFriend4.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(4);

			}

		});

		MyFriend5.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(5);

			}

		});

		MyFriend6.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(6);

			}

		});

		MyFriend7.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(7);

			}

		});

		MyFriend8.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(8);

			}

		});

		MyFriend9.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				chat(9);

			}

		});



		moshengren1 = new JButton(new ImageIcon("image/touxiang/149-40.png"));

		moshengren1Name = new JLabel("小北");

		moshengren1Name.setFont(f);

		moshengrenlan.add(moshengren1);

		moshengrenlan.add(moshengren1Name);

		moshengrenlan.setLayout(null);

		moshengren1.setBounds(0, 0, 44, 44);

		moshengren1Name.setBounds(44, 0, 44, 44);



		heimingdan1 = new JButton(new ImageIcon("image/touxiang/150-40.png"));

		heimingdan1Name = new JLabel("小南");

		heimingdan1Name.setFont(f);

		heimingdanlan.add(heimingdan1);

		heimingdanlan.add(heimingdan1Name);

		heimingdanlan.setLayout(null);

		heimingdan1.setBounds(0, 0, 44, 44);

		heimingdan1Name.setBounds(44, 0, 44, 44);

		// 好友栏 陌生人栏 黑名单栏 切换设计

		// 规定 当"moshengren1"时陌生人按钮在下面 当"heimingdan1"时黑名单按钮在下面

		// 当"moshengren2"时陌生人按钮在上面 当"heimingdan2"时黑名单按钮在上面

		moshengren.setName("moshengren1");

		heimingdan.setName("heimingdan1");

		haoyou.addMouseListener(new MouseAdapter() {



		});

		moshengren.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren1")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);

					moshengren.setName("moshengren2");

					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 371);

					qqClientFriendsList1.repaint();

				}



			}



		});

		moshengren_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (moshengren.getName().equals("moshengren2")

						&& heimingdan.getName().equals("heimingdan1")) {

					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 191, 165, 370);

					qqClientFriendsList1.repaint();



				} else {

					qqClientFriendsList1.add(moshengren);



					qqClientFriendsList1.remove(moshengren_);

					qqClientFriendsList1.add(moshengren);

					moshengren.setBounds(50, 560, 165, 48);

					moshengren.setName("moshengren1");

					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(haoyoulan);

					haoyoulan.setBounds(50, 192, 165, 369);

					qqClientFriendsList1.repaint();

				}



			}



		});

		heimingdan.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren1")) {

					qqClientFriendsList1.remove(moshengren);

					qqClientFriendsList1.add(moshengren_);

					moshengren_.setBounds(50, 190, 165, 48);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					moshengren.setName("moshengren2");



					qqClientFriendsList1.remove(haoyoulan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 369);

					qqClientFriendsList1.repaint();

				} else if (heimingdan.getName().equals("heimingdan1")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(moshengrenlan);

					qqClientFriendsList1.add(heimingdanlan);

					heimingdanlan.setBounds(50, 286, 165, 370);



					qqClientFriendsList1.remove(heimingdan);

					qqClientFriendsList1.add(heimingdan_);

					heimingdan_.setBounds(50, 238, 165, 48);

					heimingdan.setName("heimingdan2");

					qqClientFriendsList1.repaint();



				}

			}



		});

		heimingdan_.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				if (heimingdan.getName().equals("heimingdan2")

						&& moshengren.getName().equals("moshengren2")) {



					qqClientFriendsList1.remove(heimingdan_);

					qqClientFriendsList1.add(heimingdan);

					heimingdan.setBounds(50, 607, 165, 48);

					heimingdan.setName("heimingdan1");



					qqClientFriendsList1.remove(heimingdanlan);

					qqClientFriendsList1.add(moshengrenlan);

					moshengrenlan.setBounds(50, 238, 165, 370);

					qqClientFriendsList1.repaint();

				}



			}



		});



		// 获得当前鼠标坐标

		qqClientFriendsList1.addMouseMotionListener(new MouseAdapter() {

			public void mouseMoved(MouseEvent e) {

				x = e.getX();

				y = e.getY();

				System.out.println("当前X坐标是:" + x + " Y坐标是:" + y);



			}



		});

		// 判断边界窗口消失

		// qqClientFriendsList1.addMouseListener(new MouseAdapter() {

		// public void mouseExited(MouseEvent e) {

		// System.out.println("离开时X、Y坐标是:" + x + " " + y);

		// if (x > 260 || y > 645 || x < 5) {

		// qqClientFriendsList1.setVisible(false);

		// new QqClientFriendsListX01();

		//

		//

		// }

		//

		// }

		//

		// });

		//



	}



	public void chat(int i) {

		QqClientFriendsChat01 qqchat = new QqClientFriendsChat01(ownerqq,

				MyFriendArrayName[i-1].getText(), qqs[i - 1]);

		String str = ownerqq + " " + qqs[i - 1];

		System.out.println(str);

		chats.put(str, qqchat);

	}



	public static void main(String[] args) {

		new QqClientFriendsList01();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseDragged(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseMoved(MouseEvent e) {



		// TODO Auto-generated method stub



	}



	public void dealMsg(MsgHead msg) {

		if (msg.getType() == MsgType.command_perdata) {

			MsgPerData mpd = (MsgPerData) msg;

			// mpd.getDest();

			// mpd.getIcon();

			// mpd.getSex();

			// mpd.getNickname();

			// 刷新界面

			ownerqq = mpd.getDest();

			flushNick(mpd.getNickname());

			flushQqNumber(mpd.getDest());

			flushTouxiang(mpd.getIcon());

			flushSex(mpd.getSex());



		} else if (msg.getType() == MsgType.command_teamList) {

			MsgTeamList mtl = (MsgTeamList) msg;

			ArrayList<TeamInfo> teams = mtl.getTeamList();

			// for (TeamInfo teamInfo : teams) {

			TeamInfo teamInfo = teams.get(0);

			ArrayList<UserInfo> users = teamInfo.getFriendList();

			for (UserInfo userInfo : users) {

				// 可以得到的数据

				userInfo.getQq();

				userInfo.getNickname();

				userInfo.getIcon();

				userInfo.getOnLine();

				userInfo.getSex();

				userInfo.getOnLine();

				// 刷新界面

				flushFriendsList(users);

			}



		} else if (msg.getType() == MsgType.command_find_resp) {

			MsgFindResp mfr = (MsgFindResp) msg;

			ArrayList<UserInfo> users = mfr.getUsers();

			// qqClientFind01的刷新方法

			flushOnlineuser(users);

		} else if (msg.getType() == MsgType.command_addFriend_Resp) {

			MsgAddFriendResp mafr = (MsgAddFriendResp) msg;

			if (mafr.getState() == 0) {

				flushAddFriend(mafr.getQq(), mafr.getNickName(), mafr.getIcon());

			} else {

				JOptionPane.showMessageDialog(null, mafr.getSrc()

						+ " 拒接你的添加好友请求!");

			}



		} else if (msg.getType() == MsgType.command_onLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_onLine);

		} else if (msg.getType() == MsgType.command_offLine) {

			// 刷新列表

			flushOnlineOffline(msg.getSrc(), MsgType.command_offLine);

		} else if (msg.getType() == MsgType.command_chatText) {

			MsgChatText mct = (MsgChatText) msg;

			String key = mct.getDest()+" "+mct.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == mct.getSrc()) {

					num = i;

					break;

				}

			}

			

			//System.out.println("MyFriendArrayName[num].getText()"+MyFriendArrayName[num].getText()+" num:"+num+" key:"+key);

			

			qqClientFriendsChat01 = chats.get(key);

			if (qqClientFriendsChat01 == null) {

				qqClientFriendsChat01 = new QqClientFriendsChat01(ownerqq,

						MyFriendArrayName[num].getText(), mct.getSrc());

				chats.put(key, qqClientFriendsChat01);

			}



			qqClientFriendsChat01.flushFriendMsg(mct.getTime(),mct.getContent(),

					MyFriendArrayName[num].getText() );

		} else if (msg.getType() == MsgType.command_addYou) {

			MsgAddYou may = (MsgAddYou) msg;

			may.getSex();

			may.getNote();

			may.getNickname();

			may.getSrc();

			// 弹出界面

			new QqClientAcceptFriends01(ownerqq).flushAccept(may.getSrc(),

					may.getNickname(), may.getNote());

		}else if(msg.getType() == MsgType.command_vibration){

			String key = msg.getDest()+" "+msg.getSrc();

			// 刷新数据

			int num = 0;

			for (int i = 0; i < 10; i++) {

				if (qqs[i] == msg.getSrc()) {

					num = i;

					break;

				}

			}

			qqClientFriendsChat01 = chats.get(key);

			if (qqClientFriendsChat01 == null) {

				qqClientFriendsChat01 = new QqClientFriendsChat01(ownerqq,

						MyFriendArrayName[num].getText(), msg.getSrc());

				chats.put(key, qqClientFriendsChat01);

			}

			//震动窗口

			qqClientFriendsChat01.Vibration();

		}

	}



}

 

package view;



import java.awt.Font;

import java.awt.List;

import java.awt.TextArea;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;



import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;



import msg.MsgChatText;

import msg.MsgType;

import client.ClientConServer;



@SuppressWarnings("serial")

public class QqClientFriendsGroupChat extends JFrame implements MouseListener {

	JFrame qqClientFriendsChat;

	JLabel up, down, left, right;

	TextArea inputinfo, outputinfo;

	Font f,ff;

	JButton inputTextJButton, inputFileJButton, exitJButton, hideJButton,

			lookJButton, quakeJButton;

	JLabel title ,groupListJLabel;

	List groupList;

	String nickName;

	// 发送打包好的Msg

	@SuppressWarnings("unused")

	private ClientConServer ccs = ClientConServer.getCcs();

	// 定义Msg

	MsgChatText mct;



	// 刷新方法

	public void flushNick() {

		qqClientFriendsChat.remove(title);

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		qqClientFriendsChat.remove(up);

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

	}



	public QqClientFriendsGroupChat() {

		qqClientFriendsChat = new JFrame();

		final JFrame qqClientFriendsChat = this;

		f = new Font("DaiYu", Font.BOLD, 26);

		ff = new Font("DaiYu", Font.BOLD, 14);

		exitJButton = new JButton(new ImageIcon("image/chatJiemian01/exit.jpg"));

		nickName = "小明";

		title = new JLabel("在与" + nickName + "的聊天");

		//

		up = new JLabel(new ImageIcon("image/chatJiemian01/up.jpg"));

		down = new JLabel(new ImageIcon("image/chatJiemian01/down.jpg"));

		left = new JLabel(new ImageIcon("image/chatJiemian01/left.jpg"));

		right = new JLabel(new ImageIcon("image/chatJiemian01/right.jpg"));

		inputinfo = new TextArea("");

		outputinfo = new TextArea();

		inputTextJButton = new JButton(new ImageIcon(

				"image/chatJiemian01/inputText.jpg"));

		inputFileJButton = new JButton(new ImageIcon(

				"image/chatJiemian01/inputFile.jpg"));

		hideJButton = new JButton(new ImageIcon("image/chatJiemian01/hide.jpg"));

		lookJButton = new JButton(new ImageIcon("image/chatJiemian01/look.jpg"));

		quakeJButton = new JButton(new ImageIcon(

				"image/chatJiemian01/quake.jpg"));

		// 群好友列表

		groupListJLabel = new JLabel("群好友列表");

		groupList = new List();

		// 窗口设置

		qqClientFriendsChat.setUndecorated(true);

		qqClientFriendsChat.setLayout(null);

		qqClientFriendsChat.setSize(500, 500); // 设置窗口大小

		qqClientFriendsChat.setLocation(450, 130);

		qqClientFriendsChat.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置关闭

		qqClientFriendsChat.setVisible(true); // 设置窗口可视

		qqClientFriendsChat.setResizable(false); // 设置窗口大小不可调

		// 字体设置

		inputinfo.setFont(f);

		outputinfo.setFont(f);

		title.setFont(f);

		// 标题位置

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		// 周围背景

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

		qqClientFriendsChat.add(down);

		down.setBounds(0, 450, 500, 50);

		qqClientFriendsChat.add(left);

		left.setBounds(0, 50, 50, 400);

		qqClientFriendsChat.add(right);

		right.setBounds(450, 50, 50, 400);

		// 顶部部分按钮

		qqClientFriendsChat.add(exitJButton);

		exitJButton.setBounds(400, 0, 100, 50);

		qqClientFriendsChat.add(hideJButton);

		hideJButton.setBounds(300, 0, 100, 50);

		// 中间部分按钮

		qqClientFriendsChat.add(lookJButton);

		lookJButton.setBounds(50, 300, 50, 50);

		qqClientFriendsChat.add(quakeJButton);

		quakeJButton.setBounds(100, 300, 50, 50);

		qqClientFriendsChat.add(inputTextJButton);

		inputTextJButton.setBounds(350, 300, 100, 50);

		qqClientFriendsChat.add(inputFileJButton);

		inputFileJButton.setBounds(150, 300, 200, 50);



		// 输入框 输出框 好友列表

		qqClientFriendsChat.add(groupListJLabel);

		groupListJLabel.setBounds(370, 50, 80, 40);

		qqClientFriendsChat.add(inputinfo);

		inputinfo.setBounds(50, 350, 400, 100);

		qqClientFriendsChat.add(outputinfo);

		outputinfo.setBounds(50, 50, 320, 250);

		qqClientFriendsChat.add(groupList);

		groupList.setBounds(370, 90, 80, 210);

		// 加几个看看效果

		groupListJLabel.setFont(ff);

		groupList.setFont(ff);

		groupList.add("小明");

		groupList.add("小明");

		groupList.add("小明");

		groupList.add("小明");

		groupList.add("小明");





		// 按钮监听

		inputTextJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("输入要说的话");

				outputinfo.append("我说:\n" + inputinfo.getText() + "\n");

				inputinfo.setText("");

				mct.setContent(inputinfo.getText());

				mct.setDest(MsgType.SERVER_QQ_NUMBER);

				// mct.setSrc();

				mct.setTime("");

				mct.getTotalLen();

				mct.getType();



				// ccs.sendMsg(mct);



			}



		});

		inputFileJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("传送文件");

				JOptionPane.showMessageDialog(null, "该功能尚未实现");



			}



		});

		quakeJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("震动");

				Thread t = new Thread(new tools.Dancing(qqClientFriendsChat));

				t.start();



			}



		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("最小化聊天窗口");

				qqClientFriendsChat.setExtendedState(JFrame.ICONIFIED);



			}



		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出聊天窗口");

				qqClientFriendsChat.setVisible(false);



			}



		});



	}



	public static void main(String[] args) {

		new QqClientFriendsGroupChat();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}

}

 

package view;



import java.awt.Font;

import java.awt.TextArea;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.util.Date;



import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;



import msg.MsgChatText;

import msg.MsgHead;

import msg.MsgType;

import client.ClientConServer;



@SuppressWarnings("serial")

public class QqClientFriendsChat04 extends JFrame implements MouseListener {

	JFrame qqClientFriendsChat;

	JLabel up, down, left, right;

	TextArea inputinfo, outputinfo;

	Font f;

	JButton inputTextJButton, inputFileJButton, exitJButton, hideJButton,

			lookJButton, quakeJButton;

	JLabel title;

	private int friendqq,ownerqq;

	// 发送打包好的Msg

	@SuppressWarnings("unused")

	private ClientConServer ccs = ClientConServer.getCcs();



	// 刷新方法

	public void flushNick(String nickname) {

		qqClientFriendsChat.remove(title);

		title.setText(nickname);

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		qqClientFriendsChat.remove(up);

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

	}

	// 刷新好友发过来的消息

	public void flushFriendMsg(String time,String context,String nickname2){

		//System.out.println(time+"    "+context);

		outputinfo.append("\r\n");

		outputinfo.append(time+"   ");

		outputinfo.append("\r\n");

		outputinfo.append(nickname2 );

		outputinfo.append("说:  ");

		outputinfo.append("\r\n");

		outputinfo.append(context);



		

	}



	public QqClientFriendsChat04(int ownerqq,String nickName , int friendqq) {

		

		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		qqClientFriendsChat = new JFrame();

		final JFrame qqClientFriendsChat = this;

		f = new Font("DaiYu", Font.BOLD, 26);

		exitJButton = new JButton(new ImageIcon("image/chatJiemian04/exit.jpg"));

		//nickName = "小明";

		title = new JLabel();

		//

		

		up = new JLabel(new ImageIcon("image/chatJiemian04/up.jpg"));

		down = new JLabel(new ImageIcon("image/chatJiemian04/down.jpg"));

		left = new JLabel(new ImageIcon("image/chatJiemian04/left.jpg"));

		right = new JLabel(new ImageIcon("image/chatJiemian04/right.jpg"));

		

		//System.out.println("nickName:"+nickName);

		flushNick("在与" + nickName + "的聊天");

		inputinfo = new TextArea("");

		outputinfo = new TextArea();

		inputTextJButton = new JButton(new ImageIcon(

				"image/chatJiemian04/inputText.jpg"));

		inputFileJButton = new JButton(new ImageIcon(

				"image/chatJiemian04/inputFile.jpg"));

		hideJButton = new JButton(new ImageIcon("image/chatJiemian04/hide.jpg"));

		lookJButton = new JButton(new ImageIcon("image/chatJiemian04/look.jpg"));

		quakeJButton = new JButton(new ImageIcon(

				"image/chatJiemian04/quake.jpg"));

		// 窗口设置

		qqClientFriendsChat.setUndecorated(true);

		 Drag drag = new Drag(qqClientFriendsChat);



			drag.setDragable();

		qqClientFriendsChat.setLayout(null);

		qqClientFriendsChat.setSize(500, 500); // 设置窗口大小

		qqClientFriendsChat.setLocation(450, 130);

		qqClientFriendsChat.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置关闭

		qqClientFriendsChat.setVisible(true); // 设置窗口可视

		qqClientFriendsChat.setResizable(false); // 设置窗口大小不可调

		// 字体设置

		inputinfo.setFont(f);

		outputinfo.setFont(f);

		title.setFont(f);

		// 标题位置

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		// 周围背景

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

		qqClientFriendsChat.add(down);

		down.setBounds(0, 450, 500, 50);

		qqClientFriendsChat.add(left);

		left.setBounds(0, 50, 50, 400);

		qqClientFriendsChat.add(right);

		right.setBounds(450, 50, 50, 400);

		// 顶部部分按钮

		qqClientFriendsChat.add(exitJButton);

		exitJButton.setBounds(400, 0, 100, 50);

		qqClientFriendsChat.add(hideJButton);

		hideJButton.setBounds(300, 0, 100, 50);

		// 中间部分按钮

		qqClientFriendsChat.add(lookJButton);

		lookJButton.setBounds(50, 300, 50, 50);

		qqClientFriendsChat.add(quakeJButton);

		quakeJButton.setBounds(100, 300, 50, 50);

		qqClientFriendsChat.add(inputTextJButton);

		inputTextJButton.setBounds(350, 300, 100, 50);

		qqClientFriendsChat.add(inputFileJButton);

		inputFileJButton.setBounds(150, 300, 200, 50);



		// 输入框 输出框

		qqClientFriendsChat.add(inputinfo);

		inputinfo.setBounds(50, 350, 400, 100);

		qqClientFriendsChat.add(outputinfo);

		outputinfo.setBounds(50, 50, 400, 250);

		// 按钮监听

		inputTextJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {  

				Date date = new Date();

				String time = date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();

//				System.out.println("输入要说的话");

				String s = inputinfo.getText();

				outputinfo.append("\n"+time+"\n我说:\n" + s + "\n");

				inputinfo.setText("");

				

				System.out.println("s:"+s);

				System.out.println("inputinfo.getText().getBytes().length:  "+s.getBytes().length);

				

				MsgChatText mct = new MsgChatText();

				mct.setContent(s);			

				mct.setDest(QqClientFriendsChat04.this.friendqq);

				mct.setSrc(QqClientFriendsChat04.this.ownerqq);

				mct.setType(MsgType.command_chatText);

				mct.setTotalLen(4+1+4+4+s.getBytes().length+20);

				mct.setTime(time);

				try {

					ccs.sendMsg(mct);

				} catch (Exception e1) {

					e1.printStackTrace();

				}



			}



		});

		inputFileJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("传送文件");

				JOptionPane.showMessageDialog(null, "该功能尚未实现");



			}



		});

		quakeJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("震动");

				Vibration();

				MsgHead msg = new MsgHead();

				msg.setDest(QqClientFriendsChat04.this.friendqq);

				msg.setSrc(QqClientFriendsChat04.this.ownerqq);

				msg.setType(MsgType.command_vibration);

				msg.setTotalLen(4 + 1 + 4 + 4);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}



		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("最小化聊天窗口");

				qqClientFriendsChat.setExtendedState(JFrame.ICONIFIED);



			}



		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出聊天窗口");

				qqClientFriendsChat.setVisible(false);



			}



		});



	}



	// public static void main(String[] args) {

	//

	// }

	// 震动方法

	public void Vibration() {

		Thread t = new Thread(new tools.Dancing(qqClientFriendsChat));

		t.start();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}

}

 

package view;



import java.awt.Font;

import java.awt.TextArea;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.util.Date;



import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;



import msg.MsgChatText;

import msg.MsgHead;

import msg.MsgType;

import client.ClientConServer;



@SuppressWarnings("serial")

public class QqClientFriendsChat03 extends JFrame implements MouseListener {

	JFrame qqClientFriendsChat;

	JLabel up, down, left, right;

	TextArea inputinfo, outputinfo;

	Font f;

	JButton inputTextJButton, inputFileJButton, exitJButton, hideJButton,

			lookJButton, quakeJButton;

	JLabel title;

	private int friendqq,ownerqq;

	// 发送打包好的Msg

	@SuppressWarnings("unused")

	private ClientConServer ccs = ClientConServer.getCcs();



	// 刷新方法

	public void flushNick(String nickname) {

		qqClientFriendsChat.remove(title);

		title.setText(nickname);

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		qqClientFriendsChat.remove(up);

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

	}

	// 刷新好友发过来的消息

	public void flushFriendMsg(String time,String context,String nickname2){

		//System.out.println(time+"    "+context);

		outputinfo.append("\r\n");

		outputinfo.append(time+"   ");

		outputinfo.append("\r\n");

		outputinfo.append(nickname2 );

		outputinfo.append("说:  ");

		outputinfo.append("\r\n");

		outputinfo.append(context);



		

	}



	public QqClientFriendsChat03(int ownerqq,String nickName , int friendqq) {

		

		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		qqClientFriendsChat = new JFrame();

		final JFrame qqClientFriendsChat = this;

		f = new Font("DaiYu", Font.BOLD, 26);

		exitJButton = new JButton(new ImageIcon("image/chatJiemian03/exit.jpg"));

		//nickName = "小明";

		title = new JLabel();

		//

		

		up = new JLabel(new ImageIcon("image/chatJiemian03/up.jpg"));

		down = new JLabel(new ImageIcon("image/chatJiemian03/down.jpg"));

		left = new JLabel(new ImageIcon("image/chatJiemian03/left.jpg"));

		right = new JLabel(new ImageIcon("image/chatJiemian03/right.jpg"));

		

		//System.out.println("nickName:"+nickName);

		flushNick("在与" + nickName + "的聊天");

		inputinfo = new TextArea("");

		outputinfo = new TextArea();

		inputTextJButton = new JButton(new ImageIcon(

				"image/chatJiemian03/inputText.jpg"));

		inputFileJButton = new JButton(new ImageIcon(

				"image/chatJiemian03/inputFile.jpg"));

		hideJButton = new JButton(new ImageIcon("image/chatJiemian03/hide.jpg"));

		lookJButton = new JButton(new ImageIcon("image/chatJiemian03/look.jpg"));

		quakeJButton = new JButton(new ImageIcon(

				"image/chatJiemian03/quake.jpg"));

		// 窗口设置

		qqClientFriendsChat.setUndecorated(true);

		 Drag drag = new Drag(qqClientFriendsChat);



			drag.setDragable();

		qqClientFriendsChat.setLayout(null);

		qqClientFriendsChat.setSize(500, 500); // 设置窗口大小

		qqClientFriendsChat.setLocation(450, 130);

		qqClientFriendsChat.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置关闭

		qqClientFriendsChat.setVisible(true); // 设置窗口可视

		qqClientFriendsChat.setResizable(false); // 设置窗口大小不可调

		// 字体设置

		inputinfo.setFont(f);

		outputinfo.setFont(f);

		title.setFont(f);

		// 标题位置

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		// 周围背景

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

		qqClientFriendsChat.add(down);

		down.setBounds(0, 450, 500, 50);

		qqClientFriendsChat.add(left);

		left.setBounds(0, 50, 50, 400);

		qqClientFriendsChat.add(right);

		right.setBounds(450, 50, 50, 400);

		// 顶部部分按钮

		qqClientFriendsChat.add(exitJButton);

		exitJButton.setBounds(400, 0, 100, 50);

		qqClientFriendsChat.add(hideJButton);

		hideJButton.setBounds(300, 0, 100, 50);

		// 中间部分按钮

		qqClientFriendsChat.add(lookJButton);

		lookJButton.setBounds(50, 300, 50, 50);

		qqClientFriendsChat.add(quakeJButton);

		quakeJButton.setBounds(100, 300, 50, 50);

		qqClientFriendsChat.add(inputTextJButton);

		inputTextJButton.setBounds(350, 300, 100, 50);

		qqClientFriendsChat.add(inputFileJButton);

		inputFileJButton.setBounds(150, 300, 200, 50);



		// 输入框 输出框

		qqClientFriendsChat.add(inputinfo);

		inputinfo.setBounds(50, 350, 400, 100);

		qqClientFriendsChat.add(outputinfo);

		outputinfo.setBounds(50, 50, 400, 250);

		// 按钮监听

		inputTextJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {  

				Date date = new Date();

				String time = date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();

//				System.out.println("输入要说的话");

				String s = inputinfo.getText();

				outputinfo.append("\n"+time+"\n我说:\n" + s + "\n");

				inputinfo.setText("");

				

				System.out.println("s:"+s);

				System.out.println("inputinfo.getText().getBytes().length:  "+s.getBytes().length);

				

				MsgChatText mct = new MsgChatText();

				mct.setContent(s);			

				mct.setDest(QqClientFriendsChat03.this.friendqq);

				mct.setSrc(QqClientFriendsChat03.this.ownerqq);

				mct.setType(MsgType.command_chatText);

				mct.setTotalLen(4+1+4+4+s.getBytes().length+20);

				mct.setTime(time);

				try {

					ccs.sendMsg(mct);

				} catch (Exception e1) {

					e1.printStackTrace();

				}



			}



		});

		inputFileJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("传送文件");

				JOptionPane.showMessageDialog(null, "该功能尚未实现");



			}



		});

		quakeJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("震动");

				Vibration();

				MsgHead msg = new MsgHead();

				msg.setDest(QqClientFriendsChat03.this.friendqq);

				msg.setSrc(QqClientFriendsChat03.this.ownerqq);

				msg.setType(MsgType.command_vibration);

				msg.setTotalLen(4 + 1 + 4 + 4);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}



		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("最小化聊天窗口");

				qqClientFriendsChat.setExtendedState(JFrame.ICONIFIED);



			}



		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出聊天窗口");

				qqClientFriendsChat.setVisible(false);



			}



		});



	}



	// public static void main(String[] args) {

	//

	// }

	// 震动方法

	public void Vibration() {

		Thread t = new Thread(new tools.Dancing(qqClientFriendsChat));

		t.start();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}

}

 

package view;



import java.awt.Font;

import java.awt.TextArea;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.util.Date;



import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;



import msg.MsgChatText;

import msg.MsgHead;

import msg.MsgType;

import client.ClientConServer;



@SuppressWarnings("serial")

public class QqClientFriendsChat02 extends JFrame implements MouseListener {

	JFrame qqClientFriendsChat;

	JLabel up, down, left, right;

	TextArea inputinfo, outputinfo;

	Font f;

	JButton inputTextJButton, inputFileJButton, exitJButton, hideJButton,

			lookJButton, quakeJButton;

	JLabel title;

	private int friendqq, ownerqq;

	// 发送打包好的Msg

	@SuppressWarnings("unused")

	private ClientConServer ccs = ClientConServer.getCcs();



	// 刷新方法

	public void flushNick(String nickname) {

		qqClientFriendsChat.remove(title);

		title.setText(nickname);

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		qqClientFriendsChat.remove(up);

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

	}



	// 刷新好友发过来的消息

	public void flushFriendMsg(String time, String context, String nickname2) {

		// System.out.println(time+"    "+context);

		outputinfo.append("\r\n");

		outputinfo.append(time + "   ");

		outputinfo.append("\r\n");

		outputinfo.append(nickname2);

		outputinfo.append("说:  ");

		outputinfo.append("\r\n");

		outputinfo.append(context);



	}



	public QqClientFriendsChat02(int ownerqq, String nickName, int friendqq) {



		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		qqClientFriendsChat = new JFrame();

		final JFrame qqClientFriendsChat = this;

		f = new Font("DaiYu", Font.BOLD, 26);

		exitJButton = new JButton(new ImageIcon("image/chatJiemian02/exit.jpg"));

		// nickName = "小明";

		title = new JLabel();

		//



		up = new JLabel(new ImageIcon("image/chatJiemian02/up.jpg"));

		down = new JLabel(new ImageIcon("image/chatJiemian02/down.jpg"));

		left = new JLabel(new ImageIcon("image/chatJiemian02/left.jpg"));

		right = new JLabel(new ImageIcon("image/chatJiemian02/right.jpg"));



		// System.out.println("nickName:"+nickName);

		flushNick("在与" + nickName + "的聊天");

		inputinfo = new TextArea("");

		outputinfo = new TextArea();

		inputTextJButton = new JButton(new ImageIcon(

				"image/chatJiemian02/inputText.jpg"));

		inputFileJButton = new JButton(new ImageIcon(

				"image/chatJiemian02/inputFile.jpg"));

		hideJButton = new JButton(new ImageIcon("image/chatJiemian02/hide.jpg"));

		lookJButton = new JButton(new ImageIcon("image/chatJiemian02/look.jpg"));

		quakeJButton = new JButton(new ImageIcon(

				"image/chatJiemian02/quake.jpg"));

		// 窗口设置

		qqClientFriendsChat.setUndecorated(true);

		Drag drag = new Drag(qqClientFriendsChat);



		drag.setDragable();

		qqClientFriendsChat.setLayout(null);

		qqClientFriendsChat.setSize(500, 500); // 设置窗口大小

		qqClientFriendsChat.setLocation(450, 130);

		qqClientFriendsChat.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置关闭

		qqClientFriendsChat.setVisible(true); // 设置窗口可视

		qqClientFriendsChat.setResizable(false); // 设置窗口大小不可调

		// 字体设置

		inputinfo.setFont(f);

		outputinfo.setFont(f);

		title.setFont(f);

		// 标题位置

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		// 周围背景

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

		qqClientFriendsChat.add(down);

		down.setBounds(0, 450, 500, 50);

		qqClientFriendsChat.add(left);

		left.setBounds(0, 50, 50, 400);

		qqClientFriendsChat.add(right);

		right.setBounds(450, 50, 50, 400);

		// 顶部部分按钮

		qqClientFriendsChat.add(exitJButton);

		exitJButton.setBounds(400, 0, 100, 50);

		qqClientFriendsChat.add(hideJButton);

		hideJButton.setBounds(300, 0, 100, 50);

		// 中间部分按钮

		qqClientFriendsChat.add(lookJButton);

		lookJButton.setBounds(50, 300, 50, 50);

		qqClientFriendsChat.add(quakeJButton);

		quakeJButton.setBounds(100, 300, 50, 50);

		qqClientFriendsChat.add(inputTextJButton);

		inputTextJButton.setBounds(350, 300, 100, 50);

		qqClientFriendsChat.add(inputFileJButton);

		inputFileJButton.setBounds(150, 300, 200, 50);



		// 输入框 输出框

		qqClientFriendsChat.add(inputinfo);

		inputinfo.setBounds(50, 350, 400, 100);

		qqClientFriendsChat.add(outputinfo);

		outputinfo.setBounds(50, 50, 400, 250);

		// 按钮监听

		inputTextJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				Date date = new Date();

				String time = date.getHours() + ":" + date.getMinutes() + ":"

						+ date.getSeconds();

				// System.out.println("输入要说的话");

				String s = inputinfo.getText();

				outputinfo.append("\n" + time + "\n我说:\n" + s + "\n");

				inputinfo.setText("");



				System.out.println("s:" + s);

				System.out.println("inputinfo.getText().getBytes().length:  "

						+ s.getBytes().length);



				MsgChatText mct = new MsgChatText();

				mct.setContent(s);

				mct.setDest(QqClientFriendsChat02.this.friendqq);

				mct.setSrc(QqClientFriendsChat02.this.ownerqq);

				mct.setType(MsgType.command_chatText);

				mct.setTotalLen(4 + 1 + 4 + 4 + s.getBytes().length + 20);

				mct.setTime(time);

				try {

					ccs.sendMsg(mct);

				} catch (Exception e1) {

					e1.printStackTrace();

				}



			}



		});

		inputFileJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("传送文件");

				JOptionPane.showMessageDialog(null, "该功能尚未实现");



			}



		});

		quakeJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("震动");

				Vibration();

				MsgHead msg = new MsgHead();

				msg.setDest(QqClientFriendsChat02.this.friendqq);

				msg.setSrc(QqClientFriendsChat02.this.ownerqq);

				msg.setType(MsgType.command_vibration);

				msg.setTotalLen(4 + 1 + 4 + 4);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}



		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("最小化聊天窗口");

				qqClientFriendsChat.setExtendedState(JFrame.ICONIFIED);



			}



		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出聊天窗口");

				qqClientFriendsChat.setVisible(false);



			}



		});



	}



	// public static void main(String[] args) {

	//

	// }

	// 震动方法

	public void Vibration() {

		Thread t = new Thread(new tools.Dancing(qqClientFriendsChat));

		t.start();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}

}

 

package view;



import java.awt.Font;

import java.awt.TextArea;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.util.Date;



import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;



import msg.MsgChatText;

import msg.MsgHead;

import msg.MsgType;

import client.ClientConServer;



@SuppressWarnings("serial")

public class QqClientFriendsChat01 extends JFrame implements MouseListener {

	JFrame qqClientFriendsChat;

	JLabel up, down, left, right;

	TextArea inputinfo, outputinfo;

	Font f;

	JButton inputTextJButton, inputFileJButton, exitJButton, hideJButton,

			lookJButton, quakeJButton;

	JLabel title;

	private int friendqq, ownerqq;

	// 发送打包好的Msg

	@SuppressWarnings("unused")

	private ClientConServer ccs = ClientConServer.getCcs();



	// 刷新方法

	public void flushNick(String nickname) {

		qqClientFriendsChat.remove(title);

		title.setText(nickname);

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		qqClientFriendsChat.remove(up);

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

	}



	// 刷新好友发过来的消息

	public void flushFriendMsg(String time, String context, String nickname2) {

		// System.out.println(time+"    "+context);

		outputinfo.append("\r\n");

		outputinfo.append(time + "   ");

		outputinfo.append("\r\n");

		outputinfo.append(nickname2);

		outputinfo.append("说:  ");

		outputinfo.append("\r\n");

		outputinfo.append(context);



	}



	public QqClientFriendsChat01(int ownerqq, String nickName, int friendqq) {



		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		qqClientFriendsChat = new JFrame();

		final JFrame qqClientFriendsChat = this;

		f = new Font("DaiYu", Font.BOLD, 26);

		exitJButton = new JButton(new ImageIcon("image/chatJiemian01/exit.jpg"));

		// nickName = "小明";

		title = new JLabel();

		//



		up = new JLabel(new ImageIcon("image/chatJiemian01/up.jpg"));

		down = new JLabel(new ImageIcon("image/chatJiemian01/down.jpg"));

		left = new JLabel(new ImageIcon("image/chatJiemian01/left.jpg"));

		right = new JLabel(new ImageIcon("image/chatJiemian01/right.jpg"));



		// System.out.println("nickName:"+nickName);

		flushNick("在与" + nickName + "的聊天");

		inputinfo = new TextArea("");

		outputinfo = new TextArea();

		inputTextJButton = new JButton(new ImageIcon(

				"image/chatJiemian01/inputText.jpg"));

		inputFileJButton = new JButton(new ImageIcon(

				"image/chatJiemian01/inputFile.jpg"));

		hideJButton = new JButton(new ImageIcon("image/chatJiemian01/hide.jpg"));

		lookJButton = new JButton(new ImageIcon("image/chatJiemian01/look.jpg"));

		quakeJButton = new JButton(new ImageIcon(

				"image/chatJiemian01/quake.jpg"));

		// 窗口设置

		qqClientFriendsChat.setUndecorated(true);

		 Drag drag = new Drag(qqClientFriendsChat);



			drag.setDragable();

		qqClientFriendsChat.setLayout(null);

		qqClientFriendsChat.setSize(500, 500); // 设置窗口大小

		qqClientFriendsChat.setLocation(450, 130);

		qqClientFriendsChat.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置关闭

		qqClientFriendsChat.setVisible(true); // 设置窗口可视

		qqClientFriendsChat.setResizable(false); // 设置窗口大小不可调

		// 字体设置

		inputinfo.setFont(f);

		outputinfo.setFont(f);

		title.setFont(f);

		// 标题位置

		qqClientFriendsChat.add(title);

		title.setBounds(60, 0, 190, 50);

		// 周围背景

		qqClientFriendsChat.add(up);

		up.setBounds(0, 0, 300, 50);

		qqClientFriendsChat.add(down);

		down.setBounds(0, 450, 500, 50);

		qqClientFriendsChat.add(left);

		left.setBounds(0, 50, 50, 400);

		qqClientFriendsChat.add(right);

		right.setBounds(450, 50, 50, 400);

		// 顶部部分按钮

		qqClientFriendsChat.add(exitJButton);

		exitJButton.setBounds(400, 0, 100, 50);

		qqClientFriendsChat.add(hideJButton);

		hideJButton.setBounds(300, 0, 100, 50);

		// 中间部分按钮

		qqClientFriendsChat.add(lookJButton);

		lookJButton.setBounds(50, 300, 50, 50);

		qqClientFriendsChat.add(quakeJButton);

		quakeJButton.setBounds(100, 300, 50, 50);

		qqClientFriendsChat.add(inputTextJButton);

		inputTextJButton.setBounds(350, 300, 100, 50);

		qqClientFriendsChat.add(inputFileJButton);

		inputFileJButton.setBounds(150, 300, 200, 50);



		// 输入框 输出框

		qqClientFriendsChat.add(inputinfo);

		inputinfo.setBounds(50, 350, 400, 100);

		qqClientFriendsChat.add(outputinfo);

		outputinfo.setBounds(50, 50, 400, 250);

		// 按钮监听

		inputTextJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				Date date = new Date();

				String time = date.getHours() + ":" + date.getMinutes() + ":"

						+ date.getSeconds();

				// System.out.println("输入要说的话");

				String s = inputinfo.getText();

				outputinfo.append("\n" + time + "\n我说:\n" + s + "\n");

				inputinfo.setText("");



				System.out.println("s:" + s);

				System.out.println("inputinfo.getText().getBytes().length:  "

						+ s.getBytes().length);



				MsgChatText mct = new MsgChatText();

				mct.setContent(s);

				mct.setDest(QqClientFriendsChat01.this.friendqq);

				mct.setSrc(QqClientFriendsChat01.this.ownerqq);

				mct.setType(MsgType.command_chatText);

				mct.setTotalLen(4 + 1 + 4 + 4 + s.getBytes().length + 20);

				mct.setTime(time);

				try {

					ccs.sendMsg(mct);

				} catch (Exception e1) {

					e1.printStackTrace();

				}



			}



		});

		inputFileJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("传送文件");

				JOptionPane.showMessageDialog(null, "该功能尚未实现");



			}



		});

		quakeJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("震动");

				Vibration();

				MsgHead msg = new MsgHead();

				msg.setDest(QqClientFriendsChat01.this.friendqq);

				msg.setSrc(QqClientFriendsChat01.this.ownerqq);

				msg.setType(MsgType.command_vibration);

				msg.setTotalLen(4 + 1 + 4 + 4);

				try {

					ccs.sendMsg(msg);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}



		});



		hideJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("最小化聊天窗口");

				qqClientFriendsChat.setExtendedState(JFrame.ICONIFIED);



			}



		});

		exitJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				System.out.println("退出聊天窗口");

				qqClientFriendsChat.setVisible(false);



			}



		});



	}



	// public static void main(String[] args) {

	//

	// }

	// 震动方法

	public void Vibration() {

		Thread t = new Thread(new tools.Dancing(qqClientFriendsChat));

		t.start();

	}



	@Override

	public void mouseClicked(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mousePressed(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseReleased(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseEntered(MouseEvent e) {

		// TODO Auto-generated method stub



	}



	@Override

	public void mouseExited(MouseEvent e) {

		// TODO Auto-generated method stub



	}

}

 

package view;



import java.awt.Font;

import java.awt.List;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientFind04 extends JFrame {



	private JFrame qqClientFindJFrame;

	int locationInt;

	private int ownerqq;

	

	public void setQqClientFindJFrameLeft() {

		qqClientFindJFrame.setLocation(284, 575);

		locationInt = 0;

	}



	public void setQqClientFindJFrameRight() {

		qqClientFindJFrame.setLocation(694, 575);

		locationInt = 1;

	}



	JLabel qqClientFindJLabel, findListJLabel;

	RoundButton exitFindJButton, startFindJButton;

	List findList;

	JTextArea findJTextArea;

	Font f, i;



	public QqClientFind04(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		qqClientFindJFrame = new JFrame();



		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian04/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请在这里输入QQ号");

		findListJLabel = new JLabel("当前在线用户");

		findList = new List();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		//



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 25, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(270, 25, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(100, 10, 150, 20);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(120, 30, 150, 30);

		qqClientFindJFrame.add(findList);

		findList.setBounds(100, 60, 150, 40);

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				String[] splitFindList;

				System.out.println("当前选择:" + findList.getSelectedItem());

				splitFindList = findList.getSelectedItem().split(" ");

				System.out.println("切分后:" + splitFindList[0]);

				if (locationInt == 0) {

					new QqClientAddFriends04(QqClientFind04.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationLeft();

				}

				if (locationInt == 1) {

					new QqClientAddFriends04(QqClientFind04.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationRight();

				}



			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientFind04();

//	}

}

 

package view;



import java.awt.Font;

import java.awt.List;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientFind03 extends JFrame {



	private JFrame qqClientFindJFrame;

	int locationInt;

	private int ownerqq;

	

	public void setQqClientFindJFrameLeft() {

		qqClientFindJFrame.setLocation(284, 575);

		locationInt = 0;

	}



	public void setQqClientFindJFrameRight() {

		qqClientFindJFrame.setLocation(694, 575);

		locationInt = 1;

	}



	JLabel qqClientFindJLabel, findListJLabel;

	RoundButton exitFindJButton, startFindJButton;

	List findList;

	JTextArea findJTextArea;

	Font f, i;



	public QqClientFind03(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		qqClientFindJFrame = new JFrame();



		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian03/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请在这里输入QQ号");

		findListJLabel = new JLabel("当前在线用户");

		findList = new List();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		//



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 25, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(270, 25, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(100, 10, 150, 20);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(120, 30, 150, 30);

		qqClientFindJFrame.add(findList);

		findList.setBounds(100, 60, 150, 40);

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				String[] splitFindList;

				System.out.println("当前选择:" + findList.getSelectedItem());

				splitFindList = findList.getSelectedItem().split(" ");

				System.out.println("切分后:" + splitFindList[0]);

				if (locationInt == 0) {

					new QqClientAddFriends03(QqClientFind03.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationLeft();

				}

				if (locationInt == 1) {

					new QqClientAddFriends03(QqClientFind03.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationRight();

				}



			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientFind03();

//	}

}

 

package view;



import java.awt.Font;

import java.awt.List;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientFind02 extends JFrame {



	private JFrame qqClientFindJFrame;

	int locationInt;

	private int ownerqq;

	

	public void setQqClientFindJFrameLeft() {

		qqClientFindJFrame.setLocation(284, 575);

		locationInt = 0;

	}



	public void setQqClientFindJFrameRight() {

		qqClientFindJFrame.setLocation(694, 575);

		locationInt = 1;

	}



	JLabel qqClientFindJLabel, findListJLabel;

	RoundButton exitFindJButton, startFindJButton;

	List findList;

	JTextArea findJTextArea;

	Font f, i;



	public QqClientFind02(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		qqClientFindJFrame = new JFrame();



		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian02/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请在这里输入QQ号");

		findListJLabel = new JLabel("当前在线用户");

		findList = new List();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		//



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 25, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(270, 25, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(100, 10, 150, 20);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(120, 30, 150, 30);

		qqClientFindJFrame.add(findList);

		findList.setBounds(100, 60, 150, 40);

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				String[] splitFindList;

				System.out.println("当前选择:" + findList.getSelectedItem());

				splitFindList = findList.getSelectedItem().split(" ");

				System.out.println("切分后:" + splitFindList[0]);

				if (locationInt == 0) {

					new QqClientAddFriends02(QqClientFind02.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationLeft();

				}

				if (locationInt == 1) {

					new QqClientAddFriends02(QqClientFind02.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationRight();

				}



			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientFind02();

//	}

}

 

package view;



import java.awt.Font;

import java.awt.List;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientFind01 extends JFrame {



	private JFrame qqClientFindJFrame;

	int locationInt;

	private int ownerqq;

	

	public void setQqClientFindJFrameLeft() {

		qqClientFindJFrame.setLocation(284, 575);

		locationInt = 0;

	}



	public void setQqClientFindJFrameRight() {

		qqClientFindJFrame.setLocation(694, 575);

		locationInt = 1;

	}



	JLabel qqClientFindJLabel, findListJLabel;

	RoundButton exitFindJButton, startFindJButton;

	List findList;

	JTextArea findJTextArea;

	Font f, i;



	public QqClientFind01(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		qqClientFindJFrame = new JFrame();



		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian01/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请在这里输入QQ号");

		findListJLabel = new JLabel("当前在线用户");

		findList = new List();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		//



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 25, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(270, 25, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(100, 10, 150, 20);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(120, 30, 150, 30);

		qqClientFindJFrame.add(findList);

		findList.setBounds(100, 60, 150, 40);

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				String[] splitFindList;

				System.out.println("当前选择:" + findList.getSelectedItem());

				splitFindList = findList.getSelectedItem().split(" ");

				System.out.println("切分后:" + splitFindList[0]);

				if (locationInt == 0) {

					new QqClientAddFriends01(QqClientFind01.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationLeft();

				}

				if (locationInt == 1) {

					new QqClientAddFriends01(QqClientFind01.this.ownerqq,Integer.valueOf(splitFindList[0])).setLocationRight();

				}



			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientFind01();

//	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;



import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import msg.MsgAddFriend;

import msg.MsgType;



import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAddFriends04 extends JFrame {



	private int ownerqq, friendqq;

	private ClientConServer ccs = ClientConServer.getCcs();

	static JFrame qqClientFindJFrame;

	int locationInt;



	public void setLocationRight() {

		qqClientFindJFrame.setLocation(694, 445);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFindJFrame.setLocation(284, 445);

		locationInt = 0;

	}



	JLabel qqClientFindJLabel, findListJLabel, add1JLabel, add2JLabel,

			haomaJLabel;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma;



	public QqClientAddFriends04(int ownerqq, int friendqq) {

		//

		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		add1JLabel = new JLabel("您正在添加");

		haomaJLabel = new JLabel(friendqq + "");

		add2JLabel = new JLabel("为好友");



		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian04/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请填写备注");

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);



		//

		qqClientFindJFrame.add(add1JLabel);

		add1JLabel.setBounds(15, 5, 90, 30);

		qqClientFindJFrame.add(add2JLabel);

		add2JLabel.setBounds(115, 5, 60, 30);

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(83, 5, 30, 30);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// System.out.println("发送加好友信息");

				try {

					MsgAddFriend maf = new MsgAddFriend();

					maf.setDest(QqClientAddFriends04.this.friendqq);

					maf.setSrc(QqClientAddFriends04.this.ownerqq);

					maf.setNote(findJTextArea.getText());

					maf.setType(MsgType.command_addFriend);

					maf.setFriendQq(QqClientAddFriends04.this.friendqq);

					maf.setTotalLen(4 + 1 + 4 + 4 + 4 + 30);

					ccs.sendMsg(maf);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



	public static void main(String[] args) {



	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;



import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import msg.MsgAddFriend;

import msg.MsgType;



import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAddFriends03 extends JFrame {



	private int ownerqq, friendqq;

	private ClientConServer ccs = ClientConServer.getCcs();

	static JFrame qqClientFindJFrame;

	int locationInt;



	public void setLocationRight() {

		qqClientFindJFrame.setLocation(694, 445);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFindJFrame.setLocation(284, 445);

		locationInt = 0;

	}



	JLabel qqClientFindJLabel, findListJLabel, add1JLabel, add2JLabel,

			haomaJLabel;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma;



	public QqClientAddFriends03(int ownerqq, int friendqq) {

		//

		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		add1JLabel = new JLabel("您正在添加");

		haomaJLabel = new JLabel(friendqq + "");

		add2JLabel = new JLabel("为好友");



		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian03/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请填写备注");

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);



		//

		qqClientFindJFrame.add(add1JLabel);

		add1JLabel.setBounds(15, 5, 90, 30);

		qqClientFindJFrame.add(add2JLabel);

		add2JLabel.setBounds(115, 5, 60, 30);

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(83, 5, 30, 30);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// System.out.println("发送加好友信息");

				try {

					MsgAddFriend maf = new MsgAddFriend();

					maf.setDest(QqClientAddFriends03.this.friendqq);

					maf.setSrc(QqClientAddFriends03.this.ownerqq);

					maf.setNote(findJTextArea.getText());

					maf.setType(MsgType.command_addFriend);

					maf.setFriendQq(QqClientAddFriends03.this.friendqq);

					maf.setTotalLen(4 + 1 + 4 + 4 + 4 + 30);

					ccs.sendMsg(maf);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



	public static void main(String[] args) {



	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;



import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import msg.MsgAddFriend;

import msg.MsgType;



import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAddFriends02 extends JFrame {



	private int ownerqq, friendqq;

	private ClientConServer ccs = ClientConServer.getCcs();

	static JFrame qqClientFindJFrame;

	int locationInt;



	public void setLocationRight() {

		qqClientFindJFrame.setLocation(694, 445);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFindJFrame.setLocation(284, 445);

		locationInt = 0;

	}



	JLabel qqClientFindJLabel, findListJLabel, add1JLabel, add2JLabel,

			haomaJLabel;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma;



	public QqClientAddFriends02(int ownerqq, int friendqq) {

		//

		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		add1JLabel = new JLabel("您正在添加");

		haomaJLabel = new JLabel(friendqq + "");

		add2JLabel = new JLabel("为好友");



		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian02/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请填写备注");

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);



		//

		qqClientFindJFrame.add(add1JLabel);

		add1JLabel.setBounds(15, 5, 90, 30);

		qqClientFindJFrame.add(add2JLabel);

		add2JLabel.setBounds(115, 5, 60, 30);

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(83, 5, 30, 30);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// System.out.println("发送加好友信息");

				try {

					MsgAddFriend maf = new MsgAddFriend();

					maf.setDest(QqClientAddFriends02.this.friendqq);

					maf.setSrc(QqClientAddFriends02.this.ownerqq);

					maf.setNote(findJTextArea.getText());

					maf.setType(MsgType.command_addFriend);

					maf.setFriendQq(QqClientAddFriends02.this.friendqq);

					maf.setTotalLen(4 + 1 + 4 + 4 + 4 + 30);

					ccs.sendMsg(maf);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



	public static void main(String[] args) {



	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;



import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import msg.MsgAddFriend;

import msg.MsgType;



import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAddFriends01 extends JFrame {



	private int ownerqq, friendqq;

	private ClientConServer ccs = ClientConServer.getCcs();

	static JFrame qqClientFindJFrame;

	int locationInt;



	public void setLocationRight() {

		qqClientFindJFrame.setLocation(694, 445);

		locationInt = 1;

	}



	public void setLocationLeft() {

		qqClientFindJFrame.setLocation(284, 445);

		locationInt = 0;

	}



	JLabel qqClientFindJLabel, findListJLabel, add1JLabel, add2JLabel,

			haomaJLabel;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma;



	public QqClientAddFriends01(int ownerqq, int friendqq) {

		//

		this.ownerqq = ownerqq;

		this.friendqq = friendqq;

		add1JLabel = new JLabel("您正在添加");

		haomaJLabel = new JLabel(friendqq + "");

		add2JLabel = new JLabel("为好友");



		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian01/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请填写备注");

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setSize(350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);



		//

		qqClientFindJFrame.add(add1JLabel);

		add1JLabel.setBounds(15, 5, 90, 30);

		qqClientFindJFrame.add(add2JLabel);

		add2JLabel.setBounds(115, 5, 60, 30);

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(83, 5, 30, 30);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				// System.out.println("发送加好友信息");

				try {

					MsgAddFriend maf = new MsgAddFriend();

					maf.setDest(QqClientAddFriends01.this.friendqq);

					maf.setSrc(QqClientAddFriends01.this.ownerqq);

					maf.setNote(findJTextArea.getText());

					maf.setType(MsgType.command_addFriend);

					maf.setFriendQq(QqClientAddFriends01.this.friendqq);

					maf.setTotalLen(4 + 1 + 4 + 4 + 4 + 30);

					ccs.sendMsg(maf);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



	public static void main(String[] args) {



	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;



import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAddFriends extends JFrame {



	static JFrame qqClientFindJFrame;

	JLabel qqClientFindJLabel, findListJLabel, add1JLabel, add2JLabel , haomaJLabel;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma;

	

	



	public QqClientAddFriends() {

		//

		haoma = "1001";

		add1JLabel = new JLabel("您正在添加");

		haomaJLabel = new JLabel(haoma);

		add2JLabel = new JLabel("为好友");

		

		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian01/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");



		findJTextArea = new JTextArea("请填写备注");

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setBounds(694, 445, 350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);



		//

		qqClientFindJFrame.add(add1JLabel);

		add1JLabel.setBounds(15, 5, 90, 30);

		qqClientFindJFrame.add(add2JLabel);

		add2JLabel.setBounds(115, 5, 60, 30);

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(83, 5, 30,30);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



	public static void main(String[] args) {

		new QqClientAddFriends();

	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;

import msg.MsgAddYouResp;

import msg.MsgType;

import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAcceptFriends04 extends JFrame {

 

	private ClientConServer ccs = ClientConServer.getCcs();

	private JFrame qqClientFindJFrame;



	private int ownerqq,friendqq;

	

	public JFrame getQqClientFindJFrame() {

		return qqClientFindJFrame;

	}



	public void setQqClientFindJFrame(JFrame qqClientFindJFrame) {

		this.qqClientFindJFrame = qqClientFindJFrame;

	}



	JLabel haomaJLabel, nickJLabel, qqClientFindJLabel, findListJLabel,

			pleaseAccept;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma, nick;



	// 接受好友请求刷新

	public void flushAccept(int friendsQq, String nickName, String note) {

		this.friendqq = friendsQq;

		findJTextArea.setText(note);

		haomaJLabel.setText(friendsQq + "");

		nickJLabel.setText(nickName);

	}



	public QqClientAcceptFriends04(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		

		haoma = "1001";

		nick = "小明";

		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian04/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");

		haomaJLabel = new JLabel(haoma);

		nickJLabel = new JLabel(nick);

		pleaseAccept = new JLabel("请求添加好友");

		findJTextArea = new JTextArea();

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setBounds(694, 315, 350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		nickJLabel.setFont(i);

		pleaseAccept.setFont(i);

		//

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(2, 5, 30, 20);

		qqClientFindJFrame.add(nickJLabel);

		nickJLabel.setBounds(32, 5, 40, 20);

		qqClientFindJFrame.add(pleaseAccept);

		pleaseAccept.setBounds(68, 5, 110, 20);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		

		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setType(MsgType.command_addYouResp);

				mayr.setSrc(QqClientAcceptFriends04.this.ownerqq);

				mayr.setDest(friendqq);

				mayr.setState((byte)0);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		

		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setSrc(QqClientAcceptFriends04.this.ownerqq);

				mayr.setDest(friendqq);

				System.out.println("friendqq:"+friendqq);

				mayr.setType(MsgType.command_addYouResp);

				mayr.setState((byte)1);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientAcceptFriends04();

//	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;

import msg.MsgAddYouResp;

import msg.MsgType;

import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAcceptFriends03 extends JFrame {

 

	private ClientConServer ccs = ClientConServer.getCcs();

	private JFrame qqClientFindJFrame;



	private int ownerqq,friendqq;

	

	public JFrame getQqClientFindJFrame() {

		return qqClientFindJFrame;

	}



	public void setQqClientFindJFrame(JFrame qqClientFindJFrame) {

		this.qqClientFindJFrame = qqClientFindJFrame;

	}



	JLabel haomaJLabel, nickJLabel, qqClientFindJLabel, findListJLabel,

			pleaseAccept;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma, nick;



	// 接受好友请求刷新

	public void flushAccept(int friendsQq, String nickName, String note) {

		this.friendqq = friendsQq;

		findJTextArea.setText(note);

		haomaJLabel.setText(friendsQq + "");

		nickJLabel.setText(nickName);

	}



	public QqClientAcceptFriends03(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		

		haoma = "1001";

		nick = "小明";

		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian03/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");

		haomaJLabel = new JLabel(haoma);

		nickJLabel = new JLabel(nick);

		pleaseAccept = new JLabel("请求添加好友");

		findJTextArea = new JTextArea();

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setBounds(694, 315, 350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		nickJLabel.setFont(i);

		pleaseAccept.setFont(i);

		//

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(2, 5, 30, 20);

		qqClientFindJFrame.add(nickJLabel);

		nickJLabel.setBounds(32, 5, 40, 20);

		qqClientFindJFrame.add(pleaseAccept);

		pleaseAccept.setBounds(68, 5, 110, 20);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		

		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setType(MsgType.command_addYouResp);

				mayr.setSrc(QqClientAcceptFriends03.this.ownerqq);

				mayr.setDest(friendqq);

				mayr.setState((byte)0);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		

		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setSrc(QqClientAcceptFriends03.this.ownerqq);

				mayr.setDest(friendqq);

				System.out.println("friendqq:"+friendqq);

				mayr.setType(MsgType.command_addYouResp);

				mayr.setState((byte)1);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientAcceptFriends03();

//	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;

import msg.MsgAddYouResp;

import msg.MsgType;

import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAcceptFriends02 extends JFrame {

 

	private ClientConServer ccs = ClientConServer.getCcs();

	private JFrame qqClientFindJFrame;



	private int ownerqq,friendqq;

	

	public JFrame getQqClientFindJFrame() {

		return qqClientFindJFrame;

	}



	public void setQqClientFindJFrame(JFrame qqClientFindJFrame) {

		this.qqClientFindJFrame = qqClientFindJFrame;

	}



	JLabel haomaJLabel, nickJLabel, qqClientFindJLabel, findListJLabel,

			pleaseAccept;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma, nick;



	// 接受好友请求刷新

	public void flushAccept(int friendsQq, String nickName, String note) {

		this.friendqq = friendsQq;

		findJTextArea.setText(note);

		haomaJLabel.setText(friendsQq + "");

		nickJLabel.setText(nickName);

	}



	public QqClientAcceptFriends02(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		

		haoma = "1001";

		nick = "小明";

		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian02/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");

		haomaJLabel = new JLabel(haoma);

		nickJLabel = new JLabel(nick);

		pleaseAccept = new JLabel("请求添加好友");

		findJTextArea = new JTextArea();

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setBounds(694, 315, 350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		nickJLabel.setFont(i);

		pleaseAccept.setFont(i);

		//

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(2, 5, 30, 20);

		qqClientFindJFrame.add(nickJLabel);

		nickJLabel.setBounds(32, 5, 40, 20);

		qqClientFindJFrame.add(pleaseAccept);

		pleaseAccept.setBounds(68, 5, 110, 20);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		

		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setType(MsgType.command_addYouResp);

				mayr.setSrc(QqClientAcceptFriends02.this.ownerqq);

				mayr.setDest(friendqq);

				mayr.setState((byte)0);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		

		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setSrc(QqClientAcceptFriends02.this.ownerqq);

				mayr.setDest(friendqq);

				System.out.println("friendqq:"+friendqq);

				mayr.setType(MsgType.command_addYouResp);

				mayr.setState((byte)1);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientAcceptFriends02();

//	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;



import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.sql.rowset.JdbcRowSet;

import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import msg.MsgAddYouResp;

import msg.MsgType;



import client.ClientConServer;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAcceptFriends01 extends JFrame {

 

	private ClientConServer ccs = ClientConServer.getCcs();

	private JFrame qqClientFindJFrame;



	private int ownerqq,friendqq;

	

	public JFrame getQqClientFindJFrame() {

		return qqClientFindJFrame;

	}



	public void setQqClientFindJFrame(JFrame qqClientFindJFrame) {

		this.qqClientFindJFrame = qqClientFindJFrame;

	}



	JLabel haomaJLabel, nickJLabel, qqClientFindJLabel, findListJLabel,

			pleaseAccept;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

	String haoma, nick;



	// 接受好友请求刷新

	public void flushAccept(int friendsQq, String nickName, String note) {

		this.friendqq = friendsQq;

		findJTextArea.setText(note);

		haomaJLabel.setText(friendsQq + "");

		nickJLabel.setText(nickName);

	}



	public QqClientAcceptFriends01(int ownerqq) {

		//

		this.ownerqq = ownerqq;

		

		haoma = "1001";

		nick = "小明";

		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian01/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");

		haomaJLabel = new JLabel(haoma);

		nickJLabel = new JLabel(nick);

		pleaseAccept = new JLabel("请求添加好友");

		findJTextArea = new JTextArea();

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setBounds(694, 315, 350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		nickJLabel.setFont(i);

		pleaseAccept.setFont(i);

		//

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(2, 5, 30, 20);

		qqClientFindJFrame.add(nickJLabel);

		nickJLabel.setBounds(32, 5, 40, 20);

		qqClientFindJFrame.add(pleaseAccept);

		pleaseAccept.setBounds(68, 5, 110, 20);



		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		

		startFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setType(MsgType.command_addYouResp);

				mayr.setSrc(QqClientAcceptFriends01.this.ownerqq);

				mayr.setDest(friendqq);

				mayr.setState((byte)0);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});

		

		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

				

				MsgAddYouResp mayr = new MsgAddYouResp();

				mayr.setSrc(QqClientAcceptFriends01.this.ownerqq);

				mayr.setDest(friendqq);

				System.out.println("friendqq:"+friendqq);

				mayr.setType(MsgType.command_addYouResp);

				mayr.setState((byte)1);

				mayr.setTotalLen(4+1+4+4+1);

				

				try {

					ccs.sendMsg(mayr);

				} catch (Exception e1) {

					e1.printStackTrace();

				}

			}

		});



	}



//	public static void main(String[] args) {

//		new QqClientAcceptFriends01();

//	}

}

 

package view;



import java.awt.Choice;

import java.awt.Font;



import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JTextArea;



import tools.RoundButton;



@SuppressWarnings("serial")

public class QqClientAcceptFriends extends JFrame {



	static JFrame qqClientFindJFrame;

	JLabel haomaJLabel, nickJLabel, qqClientFindJLabel, findListJLabel ,pleaseAccept;

	RoundButton exitFindJButton, startFindJButton;

	Choice lieBiao;

	JTextArea findJTextArea;

	Font f, i;

    String haoma,nick;

	public QqClientAcceptFriends() {

		//

		haoma = "1001";

		nick = "小明";

		qqClientFindJFrame = new JFrame();

		qqClientFindJLabel = new JLabel(new ImageIcon(

				"image/listJiemian01/findLable.jpg"));

		exitFindJButton = new RoundButton("Exit");

		startFindJButton = new RoundButton("Add");

		haomaJLabel = new JLabel(haoma);

		nickJLabel = new JLabel(nick);

		pleaseAccept = new JLabel("请求添加好友");

		findJTextArea = new JTextArea("我是你的老同学!");

		findListJLabel = new JLabel("请选择加入列表");

		lieBiao = new Choice();

		f = new Font("Segoe Script", Font.BOLD, 12);

		i = new Font("DaiYu", Font.BOLD, 16);

		// 窗口设置

		qqClientFindJFrame.setUndecorated(true);

		qqClientFindJFrame.setBounds(694, 315, 350, 110);

		qqClientFindJFrame.setVisible(true);

		qqClientFindJFrame.setResizable(false);

		qqClientFindJFrame.setLayout(null);

		//

		exitFindJButton.setFont(f);

		startFindJButton.setFont(f);

		findJTextArea.setFont(i);

		findListJLabel.setFont(i);

		nickJLabel.setFont(i);

		pleaseAccept.setFont(i);

		//

		qqClientFindJFrame.add(haomaJLabel);

		haomaJLabel.setBounds(2, 5, 30, 20);

		qqClientFindJFrame.add(nickJLabel);

		nickJLabel.setBounds(32, 5, 40, 20);

		qqClientFindJFrame.add(pleaseAccept);

		pleaseAccept.setBounds(68,5, 110, 20);

		

		qqClientFindJFrame.add(startFindJButton);

		startFindJButton.setBounds(15, 30, 65, 65);

		qqClientFindJFrame.add(exitFindJButton);

		exitFindJButton.setBounds(90, 30, 65, 65);

		qqClientFindJFrame.add(findJTextArea);

		findJTextArea.setBounds(180, 10, 150, 30);

		qqClientFindJFrame.add(findListJLabel);

		findListJLabel.setBounds(190, 40, 150, 30);

		qqClientFindJFrame.add(lieBiao);

		lieBiao.setBounds(180, 70, 150, 20);

		lieBiao.add("Friends");

		lieBiao.add("Stranger");

		lieBiao.add("BlackList");

		qqClientFindJFrame.add(qqClientFindJLabel);

		qqClientFindJLabel.setBounds(0, 0, 350, 110);



		exitFindJButton.addMouseListener(new MouseAdapter() {

			public void mousePressed(MouseEvent e) {

				qqClientFindJFrame.setVisible(false);

			}

		});



	}



	public static void main(String[] args) {

		new QqClientAcceptFriends();

	}

}

 

package view;



import java.awt.Cursor;

import java.awt.Point;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.JFrame;



class Drag {

	// AWT中的POINT 类

	JFrame ff = null;



	public Drag(JFrame frame) {

		this.ff = frame;

	}



	Point loc = null;

	Point tmp = null;

	boolean isDragged = false;



	// 写一个方法里面存放鼠标事件

	public void setDragable() {

		// 给label添加鼠标事件

		ff.addMouseListener(new MouseAdapter() {

			public void mouseReleased(MouseEvent e) {

				isDragged = false;

				ff.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

			}



			// 鼠标按下触发

			public void mousePressed(MouseEvent e) {

				tmp = new Point(e.getX(), e.getY());

				isDragged = true;

				ff.setCursor(new Cursor(Cursor.MOVE_CURSOR));

			}

		});

		// 添加鼠标事件

		ff.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {

			//

			public void mouseDragged(MouseEvent e) {

				if (isDragged) {

					loc = new Point(ff.getLocation().x + e.getX() - tmp.x, ff

							.getLocation().y + e.getY() - tmp.y);

					ff.setLocation(loc);

				}

			}

		});

	}

}

 

你可能感兴趣的:(面向对象)