当前位置:网站首页>111.简易聊天室14:聊天室客户端
111.简易聊天室14:聊天室客户端
2022-06-29 22:34:00 【Jasonakeke】
题目描述
题目实现:实现聊天室客户端。运行程序,用户登录服务器后,可以从用户列表中选择单个用户进行聊天,也可以选择多个用户进行聊天。
解题思路
创建一个服务类:ChatClientFrame,继承JFrame类。用于进行用户登录、发送聊天信息和显示聊天信息,在该类中完成窗体界面的设计。
定义createClientSocket)方法,用于创建套接字对象、输出流对象以及启动线程对象对服务器转发的信息进行处理。
定义内部线程类ClientThread,用于对服务器端转发的信息进行处理,并显示在相应的控件中。
定义发送聊天信息的send()方法。
技术重点:
通过线程对接收到的信息进行处理,其中分为3种情况,第一种接收到的是登录用户,第二种接收到的是退出提示,第三种接收到的是消息。
代码详解
package question;
边栏推荐
- 英语没学好到底能不能做coder,别再纠结了先学起来
- Golang code specification sorting
- AI场景存储优化:云知声超算平台基于 JuiceFS 的存储实践
- 0. grpc environment setup
- Gnawing down the big bone - sorting (I)
- Mysql database: read write separation
- Detailed description of gaussdb (DWS) complex and diverse resource load management methods
- Day9 ---- 用户注册与登录
- Kr-gcn: an interpretable recommendation system based on knowledge aware reasoning
- Optional类的高级使用
猜你喜欢

啃下大骨头——排序(一)

Kubernetes architecture that novices must know
![Realizing deep learning framework from zero -- LSTM from theory to practice [theory]](/img/ac/164140eff1a6518d49ce25599d9c7b.png)
Realizing deep learning framework from zero -- LSTM from theory to practice [theory]

2022年第一季度保险服务数字化跟踪分析

Qt5.14.2 error connecting to the MySQL database of Ubuntu 20.04

论文浅尝 | KR-GCN: 知识感知推理的可解释推荐系统

Design of Distributed Message Oriented Middleware

解题元宇宙,网络游戏中的多元通信方案

英语没学好到底能不能做coder,别再纠结了先学起来

2022 (第五届)GIS软件技术大会开幕,GIS、IT将加速融合
随机推荐
Advanced use of the optional class
5-1 system vulnerability scanning
With the rise of China's database, Alibaba cloud lifeifei: China's cloud database has taken the lead in various mainstream technological innovations abroad
2022 (第五届)GIS软件技术大会开幕,GIS、IT将加速融合
Golang code specification sorting
Kubernetes architecture that novices must know
80-Redis详解
Laravel 创建自己的 Facade 扩展 geoip 根据 IP 获取国家、地域、城市信息
Static keyword continuation, inheritance, rewrite, polymorphism
How to use filters in jfinal to monitor Druid for SQL execution?
Summer rainbow comes for dinner
JS function related review
Does rapid software delivery really need to be at the cost of security?
股票开户安全吗?上海股票开户。
Talk about auto in MySQL in detail_ What is the function of increment
开源了 | 文心大模型ERNIE-Tiny轻量化技术,又准又快,效果全开
SYSTEMd debugging
Spark cluster installation
Qt中使用QDomDocument和QDomnode来读取xml
Vs cannot locate program input point to DLL