资源简介

刚接触Java中的GUI编程和网络编程时觉得很有意思,所以就结合了这两个方面并结合IO、多线程的知识,做了一个GUI版的聊天室。 这个聊天室是两端开发,服务器端和客户端 **服务器端功能:** 1. 开启和关闭服务器 2. 总览聊天室内的聊天内容 3. 监听连接对象 4. 转发给客户端聊天信息 **客户端功能:** 1. 输入基本信息,服务器IP地址和端口号即可连接服 务器。 2. 查看聊天室和接收聊天室的消息记录 3. 查看了聊天室在线成员 4. 给服务器发送聊天信息

资源截图

代码片段和文件信息

package cn.hehewocao_Client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Vector;

import javax.swing.JOptionPane;

import cn.hehewocao_Windows.WindowClientChatRoom;

public class ClientRecivelinkInfoThread implements Runnable {

@Override
public void run() {
WindowClientChatRoom.model.setRowCount(0);
try {
ServerSocket ss = new ServerSocket(1111);
while (true) {
Socket s = ss.accept();
BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
String linkInfo = null;
Vector row = new Vector();
Vector columnNames = new Vector();
columnNames.add(“连接编号“);
columnNames.add(“昵称“);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-06-04 16:18  ChatRoomGUI\
     文件         232  2019-05-23 10:11  ChatRoomGUI\.classpath
     文件         387  2019-05-23 10:11  ChatRoomGUI\.project
     文件         149  2019-06-04 16:18  ChatRoomGUI\ChatRoomGUI.eml
     文件         129  2019-06-04 16:18  ChatRoomGUI\ChatRoomGUI.iml
     文件           0  2019-07-18 16:54  ChatRoomGUI\MessageRecord.txt
     目录           0  2019-07-18 15:42  ChatRoomGUI\bin\
     目录           0  2019-07-18 15:42  ChatRoomGUI\bin\cn\
     目录           0  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Client\
     文件        1984  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Client\ClientRecivelinkInfoThread.class
     文件        2604  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Client\ClientReciveThread.class
     目录           0  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Server\
     文件        2090  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Server\ServerAcceptThread.class
     文件        4235  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Server\ServerReciveThread.class
     文件        1029  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Server\ServerThread.class
     目录           0  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_ServerTools\
     文件        4301  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_ServerTools\ServerTools.class
     目录           0  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_User\
     文件         863  2019-07-18 16:51  ChatRoomGUI\bin\cn\hehewocao_User\User.class
     文件        2771  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_User\UserThread.class
     文件        1613  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_User\UserTools.class
     目录           0  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\
     文件         787  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClient$1.class
     文件         991  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClient$2$1.class
     文件        2422  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClient$2.class
     文件         738  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClient$3.class
     文件        3508  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClient.class
     文件         827  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClientChatRoom$1.class
     文件        1619  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClientChatRoom$2.class
     文件        1836  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClientChatRoom$3.class
     文件         896  2019-07-18 15:42  ChatRoomGUI\bin\cn\hehewocao_Windows\WindowClientChatRoom$4.class
............此处省略25个文件信息

评论

共有 条评论