资源简介
用java CS 模式实现的简单版的java实现的仿qq聊天程序,有上线下线弹窗提醒、聊天、上传头像、自动更新好友列表、自动加载好友信息、发送消息、发送文件等功能,减压后的文件夹下附有说明文件。
程序启动方法:
1、先打开目录SimpleChatServer 下的ChatServer.bat
2、然后再打开SimpleChatClient 下的ChatClient.bat
代码片段和文件信息
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 SimpleChat\SimpleChatClient\
文件 232 2013-11-26 15:32 SimpleChat\SimpleChatClient\.classpath
文件 392 2013-12-08 22:07 SimpleChat\SimpleChatClient\.project
目录 0 2013-12-08 23:46 SimpleChat\SimpleChatClient\.settings\
文件 629 2013-11-26 15:31 SimpleChat\SimpleChatClient\.settings\org.eclipse.jdt.core.prefs
文件 98 2013-12-08 23:27 SimpleChat\SimpleChatClient\ChatClient.bat
目录 0 2013-12-08 23:46 SimpleChat\SimpleChatClient\bin\
目录 0 2013-12-08 23:46 SimpleChat\SimpleChatClient\bin\com\
目录 0 2013-12-08 23:46 SimpleChat\SimpleChatClient\bin\com\lee\
目录 0 2013-12-08 23:46 SimpleChat\SimpleChatClient\bin\com\lee\client\
文件 1973 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 1897 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 2072 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 4130 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 1165 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 6002 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 3043 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 11236 2013-12-08 23:12 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientChatfr
文件 1904 2013-12-08 22:20 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientLoginfr
文件 1615 2013-12-08 22:20 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientLoginfr
文件 7232 2013-12-08 22:20 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientLoginfr
文件 1511 2013-12-08 23:16 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientMainfr
文件 1022 2013-12-08 23:16 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientMainfr
文件 4702 2013-12-08 23:16 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientMainfr
文件 5372 2013-12-08 23:16 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientMainfr
文件 16415 2013-12-08 23:16 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientMainfr
文件 1979 2013-12-08 22:07 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientRegistfr
文件 1042 2013-12-08 22:07 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientRegistfr
文件 1627 2013-12-08 22:07 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientRegistfr
文件 10064 2013-12-08 22:07 SimpleChat\SimpleChatClient\bin\com\lee\client\ClientRegistfr
............此处省略223个文件信息
- 上一篇:白话 C++ 完整版
- 下一篇:兔子跳铃铛 android游戏源码
相关资源
- 基于JSP的网上购物 (用了jsp+servlet+
- java生成二维码,中间带logo,logo居中
- 在线招聘系统 java
- Java版宠物商店
- java web电子书
- sinaWeibo javaSDK-weibo4j-oauth2-beta3.1.1
- java做的一个非常漂亮的 bbs系统
- 医药管理系统java版
- JSP+Java+MySQL企业门户网站
- java识别数字字母验证码
- java web投票系统demo
- 基于Javaweb的咖啡点餐系统
- javaweb的struts2银行简易系统
- JAVA JSP会议室预约系统
- JAVA生成PDF报表详解 包含完整案例 源
- JS前台加密java后台解密实现
- 传智播客崔希凡JavaWeb-day19JDBC第三天
- 新闻发布系统 毕业设计 jsp+Servlet+ja
- Data Structures and Algorithms in Java 6th Edi
- 基于java的银行管理系统
- 花店管理系统及其说明文档
- Android应用源码安卓与PC的Socket通信项
- JAVA版 网络五子棋 游戏
- 网上鲜花店管理系统 java
- exmaple_google_oauth2_java.zip
- java类查找工具jclassfinder
- 魔乐JAVA培训课堂笔记
- JAVA调用zpl条码打印机打印中文打印及
- websocket java 实现
- java小型游戏项目(文档与源代码)
评论
共有 条评论