Tcp 通信聊天 java 窗口化
/* 实现图形界面设计 */
import java.awt.Color;
import javax.swing.*;
public class ChatGUI
{
protected JFrame GUI; //窗体界面
protected static JTextArea chatConten,sendMessage; //内容区、发送信息区文本框
//protected JScrollPane contenPane; //滚动面板
protected JButton sendButton; //发送按钮
protected JLabel tip; //标签
public ChatGUI(String title,int n)
{
GUI = new JFrame(title); //设置标题
chatConten = new JTextArea();
sendMessage = new JTextArea();
//contenPane = new JScrollPane();
sendButton = new JButton("发送");
tip = new JLabel("输入信息:");
GUI.setSize(450,500);
GUI.setLayout(null);
GUI.setBackground(Color.gray);
//contenPane.setSize(430,300);
//contenPane.setLocation(0,0);
//contenPane.setViewportView(chatConten);
chatConten.setSize(430,300); //内容区
chatConten.setLocation(0,0);
//chatConten.setBackground(Color.blue);
tip.setSize(100,30); //标签
tip.setLocation(5,300);
sendMessage.setSize(430,100); //信息输入区