📄 muiltqqfrendsend.java
字号:
package com.myqq;
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import edu.tsinghua.lumaqq.qq.QQClient;
import edu.tsinghua.lumaqq.qq.Util;
import edu.tsinghua.lumaqq.qq.beans.QQFriend;
import edu.tsinghua.lumaqq.qq.beans.QQUser;
import edu.tsinghua.lumaqq.qq.events.IQQListener;
import edu.tsinghua.lumaqq.qq.events.QQEvent;
import edu.tsinghua.lumaqq.qq.net.PortGateFactory;
import edu.tsinghua.lumaqq.qq.packets.in.GetFriendListReplyPacket;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.SystemColor;
import java.awt.Color;
import java.awt.Toolkit;
import java.util.Vector;
import javax.swing.JPasswordField;
import javax.swing.ImageIcon;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
public class MuiltQQfrendSend extends JFrame implements IQQListener{
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JTextField jTextField = null;
private JLabel jLabel1 = null;
private JButton jButton = null;
private JTextArea jTextArea = null;
private JLabel jLabel2 = null;
private JButton jButton1 = null;
private JTextArea jTextArea1 = null;
private JLabel jLabel4 = null;
private QQClient client = null;
private QQUser user = null;
private int yourQQ = 0;
private Vector qqlist = null; // @jve:decl-index=0:
private JPasswordField jPasswordField = null;
private JButton jButton2 = null;
private JButton jButton3 = null;
JScrollPane jScrollPane1 = null;
private JScrollPane jScrollPane = null;
private JScrollPane jScrollPane11 = null;
private JScrollPane jScrollPane12 = null;
private JTextArea jTextArea2 = null;
public MuiltQQfrendSend() throws HeadlessException {
// TODO Auto-generated constructor stub
super();
initialize();
}
public MuiltQQfrendSend(GraphicsConfiguration arg0) {
super(arg0);
// TODO Auto-generated constructor stub
initialize();
}
public MuiltQQfrendSend(String arg0) throws HeadlessException {
super(arg0);
// TODO Auto-generated constructor stub
initialize();
}
public MuiltQQfrendSend(String arg0, GraphicsConfiguration arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
initialize();
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
jTextField.setText("");
jTextField.setBounds(new Rectangle(69, 6, 145, 21));
}
return jTextField;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(387, 4, 83, 24));
jButton.setText("登陆");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
jButton.setEnabled(false);
jTextArea1.setText("");
jTextArea2.setText("");
loginQQ();
}
});
}
return jButton;
}
/**
* This method initializes jTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
// Image grayImage = GrayFilter.createDisabledImage(imageIcon);
// jTextArea.paint(imageIcon);
//jTextArea.setColumns(0);
//jTextArea.setPreferredSize(new Dimension(0, 18));
// jTextArea.setWrapStyleWord(false);
// jTextArea.setLineWrap(false);
}
return jTextArea;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setBounds(new Rectangle(390, 102, 82, 25));
jButton1.setEnabled(false);
jButton1.setText("发送");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
sendMesses(yourQQ);
}
});
}
return jButton1;
}
/**
* This method initializes jTextArea1
*
* @return javax.swing.JTextArea
*/
private JTextArea getJTextArea1() {
if (jTextArea1 == null) {
jTextArea1 = new JTextArea();
jTextArea1.setForeground(Color.red);
jTextArea1.setText("");
jTextArea1.setBackground(Color.white);
}
return jTextArea1;
}
/**
* This method initializes jPasswordField
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJPasswordField() {
if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setText("");
jPasswordField.setBounds(new Rectangle(266, 6, 116, 22));
}
return jPasswordField;
}
/**
* This method initializes jButton2
*
* @return javax.swing.JButton
*/
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setBounds(new Rectangle(388, 37, 83, 24));
jButton2.setEnabled(false);
jButton2.setText("退出");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
qqlogout();
}
});
}
return jButton2;
}
/**
* This method initializes jButton3
*
* @return javax.swing.JButton
*/
private JButton getJButton3() {
if (jButton3 == null) {
jButton3 = new JButton();
jButton3.setBounds(new Rectangle(13, 137, 122, 19));
jButton3.setEnabled(false);
jButton3.setText("获取好友列表");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
jTextArea1.setText("");
jButton2.setEnabled(false);
jButton1.setEnabled(false);
client.getFriendList();
}
});
}
return jButton3;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setBounds(new Rectangle(13, 59, 367, 68));
jScrollPane.setViewportView(getJTextArea());
}
return jScrollPane;
}
/**
* This method initializes jScrollPane11
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane11() {
if (jScrollPane11 == null) {
jScrollPane11 = new JScrollPane();
jScrollPane11.setBounds(new Rectangle(14, 159, 121, 256));
jScrollPane11.setViewportView(getJTextArea1());
}
return jScrollPane11;
}
/**
* This method initializes jScrollPane12
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane12() {
if (jScrollPane12 == null) {
jScrollPane12 = new JScrollPane();
jScrollPane12.setBounds(new Rectangle(174, 162, 298, 253));
jScrollPane12.setForeground(Color.black);
jScrollPane12.setViewportView(getJTextArea2());
}
return jScrollPane12;
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -