当前位置:网站首页>111.简易聊天室14:聊天室客户端
111.简易聊天室14:聊天室客户端
2022-06-29 22:34:00 【Jasonakeke】
题目描述
题目实现:实现聊天室客户端。运行程序,用户登录服务器后,可以从用户列表中选择单个用户进行聊天,也可以选择多个用户进行聊天。
解题思路
创建一个服务类:ChatClientFrame,继承JFrame类。用于进行用户登录、发送聊天信息和显示聊天信息,在该类中完成窗体界面的设计。
定义createClientSocket)方法,用于创建套接字对象、输出流对象以及启动线程对象对服务器转发的信息进行处理。
定义内部线程类ClientThread,用于对服务器端转发的信息进行处理,并显示在相应的控件中。
定义发送聊天信息的send()方法。
技术重点:
通过线程对接收到的信息进行处理,其中分为3种情况,第一种接收到的是登录用户,第二种接收到的是退出提示,第三种接收到的是消息。
代码详解
package question;
边栏推荐
- Digital tracking analysis of insurance services in the first quarter of 2022
- Weekly Postgres world news 2022w25
- Hematemesis finishing: a rare map of architects!
- Phpspreadsheet reading and writing Excel files
- Still stay up late every day and work overtime to make statements? In fact, you don't know how to make reports efficiently
- Taishan Office Technology Lecture: all elements in a row have the same height
- 【无工具搭建PHP8+oracle11g+Windows环境】内网/无网络/Win10/PHP连接oracle数据库实例
- 啃下大骨头——排序(一)
- Arrange the array into the smallest number_ Reverse pairs in an array (merge Statistics)_ Number of occurrences of a number in an ascending array_ Ugly number (Sword finger offer)
- js函数相关的复习
猜你喜欢

math_基本初等函数图型(幂函数/指数/对数/三角/反三角)

5-1 system vulnerability scanning

联通入库|需要各地联通公司销售其产品的都需要先入总库

Gnawing down the big bone - sorting (I)

Underlying principles of file operations (file descriptors and buffers)

VS2013如何让编写的程序在其它电脑上面也能运行

2022 (第五届)GIS软件技术大会开幕,GIS、IT将加速融合

Nacos-配置中心基本使用

在线文本数字识别列表求和工具

Vs cannot locate program input point to DLL
随机推荐
R & D test time ratio, bug data analysis
Can you be a coder if you don't learn English well? Stop worrying and learn it first
mysql备份数据库linux
Deep parsing of kubernetes controller runtime
js函数相关的复习
The development of grpc
Mysql database: storage engine
這個flink cdc可以用在做oracle到mysql的,增量同步嗎
Qt中使用QDomDocument和QDomnode来读取xml
Spark cluster installation
读书郎上市背后隐忧:业绩下滑明显,市场地位较靠后,竞争力存疑
Use the leader election mechanism in kubernetes to complete your own ha application
Underlying principles of file operations (file descriptors and buffers)
英语没学好到底能不能做coder,别再纠结了先学起来
为什么在局域网(ERP服务器)共享文件夹上拷贝文件时导致全局域英特网断网
股票开户安全吗?上海股票开户。
GWD: rotating target detection based on Gaussian Wasserstein distance | ICML 2021
Ce CDC Flink peut - il être utilisé pour la synchronisation incrémentale d'Oracle à MySQL?
How can the local / park do a good job in industrial analysis?
Wireshark data analysis and forensics information pacapng