• 大小: 542KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-04
  • 语言: Java
  • 标签: java游戏  聊天室  

资源简介

java写的聊天室,更多开源游戏详尽博客http://blog.csdn.net/simon_world

资源截图

代码片段和文件信息

package cat.client;

import java.applet.applet;
import java.applet.AudioClip;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.objectInputStream;
import java.io.objectOutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import javax.swing.AbstractListModel;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ListCellRenderer;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.Border;
import javax.swing.border.titledBorder;

import cat.function.CatBean;
import cat.util.CatUtil;

class CellRenderer extends JLabel implements ListCellRenderer {
CellRenderer() {
setOpaque(true);
}

public Component getListCellRendererComponent(JList list object value
int index boolean isSelected boolean cellHasFocus) {

setBorder(BorderFactory.createEmptyBorder(5 5 5 5));// 加入宽度为5的空白边框

if (value != null) {
setText(value.toString());
setIcon(new ImageIcon(“images//1.jpg“));
}
if (isSelected) {
setBackground(new Color(255 255 153));// 设置背景色
setForeground(Color.black);
} else {
// 设置选取与取消选取的前景与背景颜色.
setBackground(Color.white); // 设置背景色
setForeground(Color.black);
}
setEnabled(list.isEnabled());
setFont(new Font(“sdf“ Font.ROMAN_baseLINE 13));
setOpaque(true);
return this;
}
}


class UUListModel extends AbstractListModel{

private Vector vs;

public UUListModel(Vector vs){
this.vs = vs;
}

@Override
public object getElementAt(int index) {
// TODO Auto-generated method stub
return vs.get(index);
}

@Override
public int getSize() {
// TODO Auto-generated method stub
return vs.size();
}

}


public class CatChatroom extends Jframe {

private static final long serialVersionUID = 6129126

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-12-07 20:33  CatChat\
     目录           0  2014-12-07 20:33  CatChat\CatClient\
     文件         232  2014-12-07 20:14  CatChat\CatClient\.classpath
     文件         385  2012-09-21 20:33  CatChat\CatClient\.project
     目录           0  2014-12-07 20:33  CatChat\CatClient\.settings\
     文件         629  2012-09-21 20:33  CatChat\CatClient\.settings\org.eclipse.jdt.core.prefs
     目录           0  2014-12-07 20:33  CatChat\CatClient\bin\
     目录           0  2014-12-07 20:33  CatChat\CatClient\bin\cat\
     目录           0  2014-12-07 20:33  CatChat\CatClient\bin\cat\client\
     文件        1050  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$1.class
     文件        2735  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$2.class
     文件        1605  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$3.class
     文件        1639  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$4.class
     文件        2993  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$5.class
     文件        5658  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$ClientInputThread$1.class
     文件        3180  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$ClientInputThread$2.class
     文件        4443  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom$ClientInputThread.class
     文件        8919  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CatChatroom.class
     文件        1570  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\CellRenderer.class
     文件         645  2014-12-07 20:14  CatChat\CatClient\bin\cat\client\UUListModel.class
     目录           0  2014-12-07 20:33  CatChat\CatClient\bin\cat\function\
     文件        3050  2014-12-07 20:14  CatChat\CatClient\bin\cat\function\CatBean.class
     文件         784  2014-12-07 20:14  CatChat\CatClient\bin\cat\function\ClientBean.class
     目录           0  2014-12-07 20:33  CatChat\CatClient\bin\cat\login\
     文件         727  2014-12-07 20:14  CatChat\CatClient\bin\cat\login\CatLogin$1.class
     文件         987  2014-12-07 20:14  CatChat\CatClient\bin\cat\login\CatLogin$2.class
     文件        2854  2014-12-07 20:14  CatChat\CatClient\bin\cat\login\CatLogin$3.class
     文件         921  2014-12-07 20:14  CatChat\CatClient\bin\cat\login\CatLogin$4.class
     文件        3534  2014-12-07 20:14  CatChat\CatClient\bin\cat\login\CatLogin.class
     文件         981  2014-12-07 20:14  CatChat\CatClient\bin\cat\login\CatResign$1.class
     文件         923  2014-12-07 20:14  CatChat\CatClient\bin\cat\login\CatResign$2.class
............此处省略50个文件信息

评论

共有 条评论