资源简介
程序分为服务器端和客户端,客户端用户可进行私聊,群聊,点对点发送文件,发送表情,输入框实现了复制粘贴功能,可以进行图片的粘贴发送(里面用到了jmf播放音乐,如果没有这个包可以把相应的语句删掉)
代码片段和文件信息
package cs.client;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.linkedList;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.Element;
import javax.swing.text.styleConstants;
import javax.swing.text.styledDocument;
public class Clientframe extends Jframe implements ActionListener {
private static final long serialVersionUID = 1L;
JButton beginbutton;
private JButton closebutton;
private JButton facebutton;
private JLabel friendslabel;
JComboBox friendscombo;
private JList friendslist;
private JLabel inputlabel;
private JTextPane inputpane;
private JLabel iplabel1;
private JLabel iplabel2;
private JScrollPane jScrollPane1;
private JScrollPane jScrollPane2;
private JButton nofilebutton;
private JButton fileokbutton;
JLabel filelabel;
private JButton filebutton;
private javax.swing.JScrollPane jScrollPane3;
private JLabel oppositelabel;
private JTextPane outputpane;
private JLabel welcomelabel;
private JButton colorbutton;
private ClientProgram clientpro = null;
private File file = null;
private String name = null;
public Set set = null;
public Vector vector = null;
public Clientframe(String s) {
initComponents();
this.setLocationRelativeTo(null);
this.name = s;
this.set = new HashSet();
this.clientpro = new ClientProgram(this);
this.clientpro.startupThread();
this.clientpro.toServer(“login:“ + name);
((JPanel)(getContentPane())).setOpaque(false);
}
private void initComponents() {
welcomelabel = new javax.swing.JLabel();
iplabel1 = new javax.swing.JLabel();
iplabel2 = new javax.swing.JLabel();
friendslabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
outputpane = new javax.swing.JTextPane();
outputpane.setEditable(false);
jScrollPane2 = new javax.swing.JScrollPane();
friendslist = new javax.swing.JList();
friendslist.addMouseListener
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 295 2009-06-10 20:33 MyQQClient\.classpath
文件 386 2009-06-10 20:33 MyQQClient\.project
文件 24966 2009-06-10 21:21 MyQQClient\audio\message.WAV
文件 1345 2009-06-12 19:42 MyQQClient\bin\cs\client\Clientfr
文件 2043 2009-06-12 19:42 MyQQClient\bin\cs\client\Clientfr
文件 1840 2009-06-12 19:42 MyQQClient\bin\cs\client\Clientfr
文件 2974 2009-06-12 19:42 MyQQClient\bin\cs\client\Clientfr
文件 14903 2009-06-12 19:42 MyQQClient\bin\cs\client\Clientfr
文件 5247 2009-06-12 19:10 MyQQClient\bin\cs\client\ClientProgram$ClientThread.class
文件 5746 2009-06-12 19:10 MyQQClient\bin\cs\client\ClientProgram.class
文件 2874 2009-06-10 21:20 MyQQClient\bin\cs\client\FromFileThread.class
文件 2138 2009-06-10 21:20 MyQQClient\bin\cs\client\ReceiveImageThread.class
文件 1819 2009-06-10 21:20 MyQQClient\bin\cs\client\SendImageThread.class
文件 2431 2009-06-10 22:18 MyQQClient\bin\cs\client\ToFileThread.class
文件 3646 2009-06-10 20:33 MyQQClient\image\00.png
文件 3167 2009-06-10 20:33 MyQQClient\image\01.png
文件 2806 2009-06-10 20:33 MyQQClient\image\02.png
文件 3716 2009-06-10 20:33 MyQQClient\image\03.png
文件 3455 2009-06-10 20:33 MyQQClient\image\04.png
文件 3548 2009-06-10 20:33 MyQQClient\image\05.png
文件 3238 2009-06-10 20:33 MyQQClient\image\06.png
文件 3430 2009-06-10 20:33 MyQQClient\image\07.png
文件 2839 2009-06-10 20:33 MyQQClient\image\08.png
文件 3712 2009-06-10 20:33 MyQQClient\image\09.png
文件 3585 2009-06-10 20:33 MyQQClient\image\10.png
文件 2809 2009-06-10 20:33 MyQQClient\image\11.png
文件 3889 2009-06-12 18:44 MyQQClient\image\icons\color.png
文件 3976 2009-06-12 19:43 MyQQClient\image\icons\face.png
文件 3775 2009-06-12 18:41 MyQQClient\image\icons\file.png
文件 140545 2009-06-04 00:13 MyQQClient\lib\swing-layout-1.0.jar
............此处省略39个文件信息
评论
共有 条评论