import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;public class QQSampleFrame extends Frame  {
public void lunchFrame() {
this.setTitle("我的QQ");
this.setLocation(50,300);//屏幕的左上角点的位置
this.setSize(50, 600);  //屏幕的宽度和高度
this.setLayout(new FlowLayout(FlowLayout.CENTER,20,40));


Button b1 = new Button ("系统");
//Button b2 = new Button ("");
Monitor m= new Monitor();

b1.addActionListener(m);
//b2.addActionListener(m);

this.add(b1);
//this.add(b2);


this.addWindowListener(new WindowAdapter(){  //窗口关闭的匿名类
public void windowClosing(WindowEvent e) {
System.exit(0);
}

});

this.setResizable(true);//能改变窗口的大小
this.setBackground(new Color(202, 204, 205));
setVisible(true);//显示出Frame这个桌面
}
public static void main (String[] args) {
QQSampleFrame qq = new QQSampleFrame();
qq.lunchFrame();

}

}
class Monitor implements ActionListener {

public void actionPerformed(ActionEvent e) {
Frame frame = new Frame("会话中");
TextField tf = new TextField();   
frame.add(tf);
try {
ServerSocket ss = new ServerSocket(4700);
Socket s = ss.accept();//拿到客户 Socket的引用 
String line; // 定义一段字符长度
BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));//带着小桶的输入的字符流 拿到这个连接的字节流转换成字符流//
PrintWriter pw = new PrintWriter (s.getOutputStream()); //打印到大侠那的输出流
BufferedReader sin = new BufferedReader(new InputStreamReader(System.in) );//键盘上的打印
System.out.println("客户  :" + br.readLine());//先读出大侠那边的字符
line = sin.readLine();//再写出自己黄勇(系统)这边的打印机
while (!line.equals("bye")) { //不等于零bye的时候
pw.println(line); //输出黄勇(系统)这边的
pw.flush();
System.out.println("系统 :" + line);
System.out.println("客户 :" + br.readLine());
}
br.close();
pw.close();
ss.close();
s.close();

} catch (Exception e1) {
e1.printStackTrace();
}

frame.setLocation(200, 300);
frame.setSize(250,300);
frame.setVisible(true);
}

}
请问我这边做为服务器端的话 另外写个客户端的话必须另起个服务器。 可是这样的话 就不能在一个Frame里了。。就像QQ这样的。。有没办法做到 你把消息发给对方 (也就是这2个按钮之间),对方接收到之后,专门显示在一个框内,一直累加。你对方输入的信息也累加在这个框中。