资源简介

主要功能:1.服务器的启动/关闭,方便控制 2.多客户端登录支持 3.多用户之间的群组聊天(群聊) 4.用户与用户之间的聊天(私聊),也称为悄悄话 5.聊天内容实时自动更新 6.管理员对非法用户的踢人功能。 7.保存聊天记录 8.清除聊天记录 9.程序各种情况的业务校验 10.人性化的提示

资源截图

代码片段和文件信息

package chatclient;


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
import java.util.*;
import java.net.*;
import java.io.*;

public class Chatframe extends Jframe {
    /**
 * 
 */
private static final long serialVersionUID = 1L;
private Socket s;
    private String clientName;
    private PrintWriter out;
    JScrollPane srpList = new JScrollPane();
    JList lstUsers = new JList();
    JScrollPane srpChat = new JScrollPane();
    JList lstChat = new JList();
    JTextField txtMessage = new JTextField();
    JComboBox cmbType = new JComboBox();
    JButton btnSend = new JButton();


    public Chatframe(Socket s String clientName) {
        try {
            this.s = s;
            this.clientName = clientName;
            this.settitle(“欢迎“ + clientName + “来到本聊天室“);
            jbInit();
        } catch (Exception exception) {

        }
    }

    private void jbInit() throws Exception {
        lstChat.setFont(new java.awt.Font(“Dialog“ Font.PLAIN 12));
        lstChat.setModel(new DefaultListModel());
        lstUsers.setFont(new java.awt.Font(“Dialog“ Font.PLAIN 12));
        lstUsers.setModel(new DefaultListModel());
        getContentPane().setLayout(null);
        Border border = BorderFactory.createEtchedBorder(Color.white
                new Color(170 170 170));
        srpList.setBorder(new titledBorder(border “用户列表“
                                           titledBorder.ABOVE_TOP
                                           titledBorder.CENTER
                                           new Font(“Dialog“ Font.PLAIN 12)));
        srpList.setBounds(new Rectangle(18 14 104 314));
        srpChat.setBounds(new Rectangle(137 16 327 309));
        srpChat.setBorder(new titledBorder(border “聊天记录“
                                           titledBorder.ABOVE_TOP
                                           titledBorder.CENTER
                                           new Font(“Dialog“ Font.PLAIN 12)));
        cmbType.setFont(new java.awt.Font(“Dialog“ Font.PLAIN 12));
        cmbType.setBounds(new Rectangle(344 333 115 28));
        Vector vc = new Vector();
        btnSend.setBounds(new Rectangle(344 372 114 28));
        btnSend.setFont(new java.awt.Font(“Dialog“ Font.PLAIN 12));
        btnSend.setText(“发送“);
        btnSend.addActionListener(new Chatframe_btnSend_actionAdapter(this));
        txtMessage.setFont(new java.awt.Font(“Dialog“ Font.PLAIN 12));
        vc.add(“群聊“);
        vc.add(“私聊“);
        cmbType.setBorder(new LineBorder(Color.GRAY));
        cmbType.setModel(new DefaultComboBoxModel(vc));
        this.getContentPane().add(srpList);
        txtMessage.setText(““);
        txtMessage.setBounds(new Rectangle(22 333 305 28));
        this.getContentPane().add(txtMessage);
        this.getContentPane().add(srpChat);
        this.getContentPane(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        232  2010-08-12 18:21  ChatApp\.classpath

     文件        383  2010-08-12 18:21  ChatApp\.project

     文件       1485  2010-08-12 18:22  ChatApp\bin\chatclient\Chatframe$ChatThread.class

     文件       2093  2010-08-12 18:22  ChatApp\bin\chatclient\Chatframe$GetThread.class

     文件       5759  2010-08-12 18:22  ChatApp\bin\chatclient\Chatframe.class

     文件        687  2010-08-12 18:22  ChatApp\bin\chatclient\Chatframe_btnSend_actionAdapter.class

     文件       4202  2010-08-12 18:22  ChatApp\bin\chatclient\LoginJframe.class

     文件        702  2010-08-12 18:22  ChatApp\bin\chatclient\LoginJframe_btnClose_actionAdapter.class

     文件        702  2010-08-12 18:22  ChatApp\bin\chatclient\LoginJframe_btnLogin_actionAdapter.class

     文件        772  2010-08-12 18:22  ChatApp\bin\chatclient\Start$1.class

     文件       1323  2010-08-12 18:22  ChatApp\bin\chatclient\Start.class

     文件       1230  2010-08-12 18:21  ChatApp\bin\chatroom\ClientBean.class

     文件       2322  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl$ChatThread.class

     文件       2575  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl$GetThread.class

     文件        986  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl$ListenerThread.class

     文件        905  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl$MyFileFilter.class

     文件      10901  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl.class

     文件        704  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl_btnClear_actionAdapter.class

     文件        701  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl_btnKick_actionAdapter.class

     文件        701  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl_btnSave_actionAdapter.class

     文件        701  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl_btnSend_actionAdapter.class

     文件        704  2010-08-12 18:23  ChatApp\bin\chatroom\ServerControl_btnStart_actionAdapter.class

     文件        766  2010-08-12 18:21  ChatApp\bin\chatroom\Start$1.class

     文件       1197  2010-08-12 18:21  ChatApp\bin\chatroom\Start.class

     文件       1485  2010-08-12 18:22  ChatApp\src\chatclient\Chatframe$ChatThread.class

     文件       2093  2010-08-12 18:22  ChatApp\src\chatclient\Chatframe$GetThread.class

     文件       5610  2010-08-12 18:22  ChatApp\src\chatclient\Chatframe.class

     文件       7035  2010-08-12 18:22  ChatApp\src\chatclient\Chatframe.java

     文件        687  2010-08-12 18:22  ChatApp\src\chatclient\Chatframe_btnSend_actionAdapter.class

     文件       4138  2010-08-12 18:22  ChatApp\src\chatclient\LoginJframe.class

............此处省略41个文件信息

评论

共有 条评论