用java CS 模式实现的简单版的java实现的仿qq聊天程序,有上线下线弹窗提醒、聊天、上传头像、自动更新好友列表、自动加载好友信息、发送消息、发送文件等功能,减压后的文件夹下附有说明文件。
程序启动方法:
1、先打开目录SimpleChatServer 下的ChatServer.bat
2、然后再打开SimpleChatClient 下的ChatClient.bat
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-12-08 23:47 SimpleChat
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClient
文件 232 2013-11-26 15:32 SimpleChatSimpleChatClient.classpath
文件 392 2013-12-08 22:07 SimpleChatSimpleChatClient.project
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClient.settings
文件 629 2013-11-26 15:31 SimpleChatSimpleChatClient.settingsorg.eclipse.jdt.core.prefs
文件 98 2013-12-08 23:27 SimpleChatSimpleChatClientChatClient.bat
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientin
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientincom
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientincomlee
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientincomleeclient
文件 1973 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe$1.class
文件 1897 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe$2.class
文件 2072 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe$3.class
文件 4130 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe$4.class
文件 1165 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe$5$1.class
文件 6002 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe$5.class
文件 3043 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe$MouseHander.class
文件 11236 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatframe.class
文件 1904 2013-12-08 22:20 SimpleChatSimpleChatClientincomleeclientClientLoginframe$1.class
文件 1615 2013-12-08 22:20 SimpleChatSimpleChatClientincomleeclientClientLoginframe$MouseHander.class
文件 7232 2013-12-08 22:20 SimpleChatSimpleChatClientincomleeclientClientLoginframe.class
文件 1511 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainframe$1.class
文件 1022 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainframe$2.class
文件 4702 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainframe$MouseHander.class
文件 5372 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainframe$clientHandler.class
文件 16415 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainframe.class
文件 1979 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistframe$1.class
文件 1042 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistframe$2.class
文件 1627 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistframe$MouseHander.class
文件 10064 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistframe.class
............此处省略223个文件信息
package com.lee.client;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Date;
import java.util.linkedList;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
import javax.swing.filechooser.FileFilter;
import com.lee.comm.ClientTransfer;
import com.lee.comm.MyImageButton;
import com.lee.comm.MyImagePanel;
import com.lee.comm.MyMouseListener;
import com.lee.comm.ServerTransfer;
import com.lee.comm.user.User;
import com.lee.comm.util.frameUtil;
import com.lee.comm.util.ImageUtil;
/**
* 聊天窗口
* */
public class ClientChatframe extends Jframe{
private JTextArea txt_sign;
private JTextArea showArea;
private JTextArea inputArea;
private static final long serialVersionUID = 1L;
private Image image = null;
private static Image defaultUserImg = null;
private JPanel mainPanel;
private User user;
private ClientMainframe parentframe;
private ClientChatframe $this = this;
private JButton btn_minbtn_closebtn_upload;
private JProgressBar progressBar;
private MouseHander hander = new MouseHander();
private File selectedFile;
private boolean isSend = false;
private boolean isReceive = false;
private JLabel label_info;
private static int transFileSize = 1024; //傳輸的文件数组初始化大小
static
{
try {
defaultUserImg = ImageUtil.getDefaultUserImage();
} catch (Exception e) {
e.printStackTrace();
}
}
{
try {
image = ImageUtil.getImageByPath(ImageUtil.systemImagePath(“square7.jpg“));
} catch (Exception e) {
e.printStackTrace();
}
}
public ClientChatframe(User user ClientMainframe mainframe) throws Exception
{
super();
this.user = user;
this.parentframe = mainframe;
this.setUndecorated(true);
MyMouseListener draglistener = new MyMouseListener(this);
this.addMouseMotionListener(draglistener);
this.addMouseListener(draglistener);
init();
}
public void init() throws Exception
{
settitle(“聊天窗口:“+user.getNickName());
frameUtil.setframeLocationCenter(this 450 450);
//this.se
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-12-08 23:47 SimpleChat
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClient
文件 232 2013-11-26 15:32 SimpleChatSimpleChatClient.classpath
文件 392 2013-12-08 22:07 SimpleChatSimpleChatClient.project
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClient.settings
文件 629 2013-11-26 15:31 SimpleChatSimpleChatClient.settingsorg.eclipse.jdt.core.prefs
文件 98 2013-12-08 23:27 SimpleChatSimpleChatClientChatClient.bat
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientin
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientincom
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientincomlee
目录 0 2013-12-08 23:46 SimpleChatSimpleChatClientincomleeclient
文件 1973 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 1897 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 2072 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 4130 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 1165 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 6002 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 3043 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 11236 2013-12-08 23:12 SimpleChatSimpleChatClientincomleeclientClientChatfr
文件 1904 2013-12-08 22:20 SimpleChatSimpleChatClientincomleeclientClientLoginfr
文件 1615 2013-12-08 22:20 SimpleChatSimpleChatClientincomleeclientClientLoginfr
文件 7232 2013-12-08 22:20 SimpleChatSimpleChatClientincomleeclientClientLoginfr
文件 1511 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainfr
文件 1022 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainfr
文件 4702 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainfr
文件 5372 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainfr
文件 16415 2013-12-08 23:16 SimpleChatSimpleChatClientincomleeclientClientMainfr
文件 1979 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistfr
文件 1042 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistfr
文件 1627 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistfr
文件 10064 2013-12-08 22:07 SimpleChatSimpleChatClientincomleeclientClientRegistfr
............此处省略223个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)