clientthread.java.svn-base
资源名称:QQ.rar [点击查看]
上传用户:hongdaled
上传日期:2007-10-03
资源大小:680k
文件大小:1k
源码类别:
ICQ/即时通讯
开发平台:
Java
- package client;
- import java.awt.TextArea;
- import java.io.DataInputStream;
- import java.io.IOException;
- import javax.swing.JTextArea;
- class clientthread extends Thread {
- public DataInputStream dis;
- public JTextArea displayarea;
- public clientthread(DataInputStream dis , JTextArea m)
- {
- this.dis=dis;
- displayarea=m;
- this.start();
- }
- public void run()
- { try {
- while(true) {
- String str = dis.readUTF();
- //读取其他客户经服务器转发的消息
- displayarea.append(str+"n");
- }
- }
- catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- //将消息添加到文本域显示
- }