亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? chatarea.java~970~

?? 1. 消息即時通信 2. 消息發(fā)送實現(xiàn)一對一、一對多等多種發(fā)送模式 3. 發(fā)送的消息實現(xiàn)多彩文本編輯
?? JAVA~970~
?? 第 1 頁 / 共 3 頁
字號:
package chat;
import java.awt.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.text.*;
import java.net.*;
import javax.swing.JTabbedPane;
import javax.swing.text.html.*;

/**
 *
 * <p>Title: 客戶端主界面</p>
 * <p>Description:客戶端主界面,包括消息編輯,消息查看,文件發(fā)送,文件接收,在線列表 </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class ChatArea extends JPanel implements Runnable{

  //聲明Constant映射類對象
  Constant constant = new Constant();
  BorderLayout borderLayout1 = new BorderLayout();
  Action action = new Action();
  //自動回復(fù)菜單事件對象
  RevertAction revertAction = new RevertAction();
  //控制臺菜單事件對象
  ConsoleAction consoleAction = new ConsoleAction();
  //聊天記錄菜單事件對象
  ChatLogAction chatLogAction = new ChatLogAction();
  //消息編輯器
  EditorMessage messageEditor = new EditorMessage();

  TablePaneAction tablePaneAction = new TablePaneAction();
  HTMLEditorKit editorKit = new HTMLEditorKit();
  String userHome = System.getProperty("user.home");
  //消息編輯器面板背景顏色
  Color bgcolor = new Color(190, 212, 255);
  //自定義邊框類對象
  OvalBorder ovalBorder = new OvalBorder(5, 5, new Color(0, 153, 255),
                                         new Color(0, 153, 255));
  //自定義樣式類對象,用于文件提示信息面板樣式控制
  static Styles style = new Styles();
  static Font font = new Font("新宋體", Font.PLAIN, 12);
  //自動回復(fù)控制變量
  static private int REVERTOPTION = 0;
  //自動回復(fù)信息
  static private String REVERTMESSAGE = null;
  //控制臺消息
  static private int CONSOLESTATE = 0;
  //聊天記錄文件對象
  File chatLogFile;
  FileInputStream chatLogIn;
  FileReader chatLogFileReader;
  BufferedReader chatLogBR;
  //圖片路徑
  String toolbarImagePath = "/images/toolbar/";
  ImageIcon sendButtonnormalIcon = new ImageIcon(getClass().getResource(
      toolbarImagePath + "sendmesagenormal.png"));
  ImageIcon sendButtonovalIcon = new ImageIcon(getClass().getResource(
      toolbarImagePath + "sendmessageoval.png"));
  ImageIcon publicTableIcon = new ImageIcon(getClass().getResource(
      toolbarImagePath +"publictable.png"));
  ImageIcon publicTableNew = new ImageIcon(getClass().getResource(
      toolbarImagePath + "publictablenew.gif"));
  ImageIcon privateTableIcon = new ImageIcon(getClass().getResource(
      toolbarImagePath + "privatetable.png"));
  ImageIcon privateTableNew = new ImageIcon(getClass().getResource(
      toolbarImagePath + "privatetablenew.gif"));
  ImageIcon fileTableIcon = new ImageIcon(getClass().getResource(
      toolbarImagePath +  "filetable.png"));
  ImageIcon fileTableNew = new ImageIcon(getClass().getResource(
      toolbarImagePath + "filetablenew.gif"));
  ImageIcon chatLogIcon = new ImageIcon(getClass().getResource(toolbarImagePath +
      "chatLog.png"));
  ImageIcon chatLogIconNew = new ImageIcon(getClass().getResource(
      toolbarImagePath + "chatLognew.gif"));

  //發(fā)送文件處理按鈕對象
  FileDisposeButton fb;
  //登錄對話框?qū)ο?  static LoginDialog loginDialog = new LoginDialog();
  //文件選擇器
  final JFileChooser chooser = new JFileChooser();
  JFontChooser fontChooser = new JFontChooser(new JFrame());

  JButton jButton1 = new JButton();
  //菜單條
  JMenuBar jmenuBar = new JMenuBar();
  JMenu loginMenu = new JMenu();
  JMenu fileMenu = new JMenu();

  JMenuItem loginOut = new JMenuItem();
  JMenuItem sendFile = new JMenuItem();

  //自動回復(fù)菜單和菜單項
  ButtonGroup revertGroup = new ButtonGroup();
  JMenu revertMenu = new JMenu();
  JCheckBoxMenuItem gongzuo = new JCheckBoxMenuItem();
  JCheckBoxMenuItem chifan = new JCheckBoxMenuItem();
  JCheckBoxMenuItem youshi = new JCheckBoxMenuItem();
  JCheckBoxMenuItem zidingyi = new JCheckBoxMenuItem();
  JCheckBoxMenuItem quxiao = new JCheckBoxMenuItem();

  //控制臺菜單和菜單項
  JMenu consoleMenu = new JMenu();
  JRadioButtonMenuItem consoleMenuItem = new JRadioButtonMenuItem();


  //聊天記錄菜單和菜單項
  ButtonGroup chatLogGroup = new ButtonGroup();
  JMenu chatLogMenu = new JMenu();

  JCheckBoxMenuItem chatLogPriMenuItem = new JCheckBoxMenuItem();
  JCheckBoxMenuItem chatLogPubMenuItem = new JCheckBoxMenuItem();
  JCheckBoxMenuItem chatLogCloseMenuItem = new JCheckBoxMenuItem();

  //存儲文件處理按鈕對象的Hashtable
  static Hashtable saveFileDisposeButton = new Hashtable();
  //公共、私人、文件提示信息組件
  static JTextPane publicChat = new JTextPane();
  static JTextPane privateChat = new JTextPane();
  static JTextPane fileInfo = new JTextPane();
  //聊天記錄顯示組件
  JTextArea chatLog = new JTextArea();
  static JTabbedPane tablePane = new JTabbedPane();

  //取得公共和私人消息顯示組件的document對象
  static Document publicChatDocument = publicChat.getDocument();
  static Document privateChatDocument = privateChat.getDocument();
  static MutableAttributeSet char_style = new SimpleAttributeSet();

  HTMLDocument privateDoc;
  HTMLDocument publicDoc;
  static StyledDocument fileInfoDoc = fileInfo.getStyledDocument();

  //聲明DefaultListModel用于用戶列表動態(tài)添加數(shù)據(jù)
  DefaultListModel model = new DefaultListModel();
  JList peopleList = new JList(model);

  //聲明用于放置公共、私人、文件提示信息、在線用戶和聊天記錄的滾動面板
  JScrollPane publicjscrollPane = new JScrollPane(publicChat);
  JScrollPane privatejscrollPane = new JScrollPane(privateChat);
  JScrollPane filejscrollPane = new JScrollPane(fileInfo);
  JScrollPane listPane = new JScrollPane(peopleList);
  JScrollPane chatLogscrollPane = new JScrollPane(chatLog);
  JSplitPane jsplitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                                          publicjscrollPane, privatejscrollPane);
  //jsplitPane2劈開面板用于放置現(xiàn)在用戶列表和tablePane
  JSplitPane jsplitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                          listPane, tablePane);

  JPanel jpanel1 = new JPanel();

  JPanel jpanel2 = new JPanel();
  JPanel jpanel3 = new JPanel();
  JPanel jpanel4 = new JPanel();
  JPanel jpanel5 = new JPanel();

  //發(fā)送消息按鈕
  JButton sendMessageButton = new JButton(sendButtonnormalIcon);

  JButton clearSendObjectButton = new JButton();

  //發(fā)送消息或文件對象顯示標(biāo)簽
  static JLabel sendObject = new JLabel("                                  ");


  File file = null;
  //存儲在先用戶列表的hashtable
  static Hashtable peopleTable = new Hashtable();
  //輸入、輸出流對象
  static DataOutputStream out = null;
  DataInputStream in = null;
  //連接服務(wù)器的socket對象(發(fā)送消息用)
  static Socket socket = null;
  Thread messageThread = null;

  //存儲發(fā)送對象的向量對象
  Vector toPeople = new Vector();
  String selectName = "";
  //存儲發(fā)送對象的Stringbuffer對象
  StringBuffer selectNameSB = new StringBuffer();

  String userName;

  public ChatArea(Hashtable peopleTable) {
    this.peopleTable = peopleTable;
    try {

      jbInit();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {

    //設(shè)置系統(tǒng)默認(rèn)的字體
    UIManager.put("Label.font", font);
    UIManager.put("List.font", font);
    UIManager.put("TabbedPane.font", font);
    UIManager.put("MenuBar.font", font);
    UIManager.put("Menu.font", font);
    UIManager.put("MenuItem.font", font);
    UIManager.put("PopupMenu.font", font);
    UIManager.put("CheckBoxMenuItem.font", font);
    UIManager.put("RadioButtonMenuItem.font", font);
    UIManager.put("OptionPane.messageFont", font);
    UIManager.put("OptionPane.buttonFont", font);
    Component[] components = jmenuBar.getComponents();
    for (int i = 0; i < components.length; i++) {
      ( (JMenu) components[i]).setFont(font);

    }

    //初始狀態(tài)設(shè)置
    publicChat.setEditable(false);
    privateChat.setEditable(false);
    fileInfo.setEditable(false);
    listPane.setPreferredSize(new Dimension(70, 75));
    centerOnScreen(loginDialog);
    centerOnScreen(fontChooser);
    loginMenu.setEnabled(false);
    fileMenu.setEnabled(false);
    revertMenu.setEnabled(false);
    consoleMenu.setEnabled(false);
    chatLogMenu.setEnabled(false);

    sendMessageButton.setEnabled(false);
    sendMessageButton.setBackground(Color.white);
    sendMessageButton.setBorder(null);
    sendMessageButton.setRolloverIcon(sendButtonovalIcon);

    clearSendObjectButton.setEnabled(false);

    publicChat.setEditable(false);
    privateChat.setEditable(false);
    jButton1.setText("jButton1");
    loginDialog.setVisible(true);
    //設(shè)置菜單和菜單顯示文本
    loginMenu.setText(constant.getLang("CA_loginMenu"));
    fileMenu.setText(constant.getLang("CA_fileMenu"));
    revertMenu.setText(constant.getLang("CA_revertMenu"));

    loginOut.setText(constant.getLang("CA_loginOut"));
    sendFile.setText(constant.getLang("CA_sendFile"));
    consoleMenu.setText(constant.getLang("CA_consoleMenu"));
    chatLogMenu.setText(constant.getLang("CA_chatLogMenu"));

    revertGroup.add(gongzuo);
    revertGroup.add(chifan);
    revertGroup.add(youshi);
    revertGroup.add(zidingyi);
    revertGroup.add(quxiao);

    chatLogGroup.add(chatLogPriMenuItem);
    chatLogGroup.add(chatLogPubMenuItem);
    chatLogGroup.add(chatLogCloseMenuItem);

    gongzuo.setText(constant.getLang("CA_gongzuo"));
    chifan.setText(constant.getLang("CA_chifan"));
    youshi.setText(constant.getLang("CA_youshi"));
    zidingyi.setText(constant.getLang("CA_zidingyi"));
    quxiao.setText(constant.getLang("CA_quxiao"));

    consoleMenuItem.setText(constant.getLang("CA_consoleMenuItem"));
    chatLogPriMenuItem.setText(constant.getLang("CA_chatLogPriMenuItem"));
    chatLogPubMenuItem.setText(constant.getLang("CA_chatLogPubMenuItem"));
    chatLogCloseMenuItem.setText(constant.getLang("CA_chatLogCloseMenuItem"));

    messageEditor.setBounds(new Rectangle(5, 5, 10, 10));
    //添加鍵盤事件,處理Ctrl+Enter發(fā)送消息
    messageEditor.messageTextPane.addKeyListener(new keyBoardAction());

    jmenuBar.add(loginMenu);
    jmenuBar.add(fileMenu);
    jmenuBar.add(revertMenu);
    jmenuBar.add(consoleMenu);
    jmenuBar.add(chatLogMenu);

    loginMenu.add(loginOut);
    fileMenu.add(sendFile);
    revertMenu.add(gongzuo);
    revertMenu.add(chifan);
    revertMenu.add(youshi);
    revertMenu.add(zidingyi);
    revertMenu.add(quxiao);
    consoleMenu.add(consoleMenuItem);
    chatLogMenu.add(chatLogPriMenuItem);
    chatLogMenu.add(chatLogPubMenuItem);
    chatLogMenu.add(chatLogCloseMenuItem);
    publicjscrollPane.setBorder(ovalBorder);
    publicjscrollPane.setBackground(Color.white);
    privatejscrollPane.setBorder(ovalBorder);
    chatLogscrollPane.setBorder(ovalBorder);
    privatejscrollPane.setBackground(Color.white);
    filejscrollPane.setBorder(ovalBorder);
    filejscrollPane.setBackground(new Color(140, 173, 215));

    tablePane.addTab("", publicTableIcon, publicjscrollPane);
    tablePane.addTab("", privateTableIcon, privatejscrollPane);
    tablePane.addTab("", fileTableIcon, filejscrollPane);
    tablePane.addMouseListener(tablePaneAction);

    //設(shè)置劈開面板
    jsplitPane1.setDividerSize(12);
    jsplitPane1.setOneTouchExpandable(true);
    jsplitPane2.setDividerSize(12);
    jsplitPane2.setOneTouchExpandable(true);

    clearSendObjectButton.setText("清除選定對像");

    //設(shè)置公共和私人聊天區(qū)的處理字符的編碼格式
    privateChat.setContentType("text/html");

    publicChat.setContentType("text/html");


    fileInfo.setBackground(new Color(140, 173, 215));
    chatLog.setEditable(false);

    //取得公共和私聊區(qū)的 Document 對象
    privateDoc = (HTMLDocument) privateChat.getDocument();
    publicDoc = (HTMLDocument) publicChat.getDocument();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩av网站免费在线| 欧美高清在线一区| 香蕉影视欧美成人| 在线播放一区二区三区| 蜜臀av亚洲一区中文字幕| 欧美一二区视频| 国产高清在线精品| 国产精品免费久久| 欧美性色黄大片手机版| 日韩精品国产精品| 国产网站一区二区三区| 成人av资源站| 有码一区二区三区| 91精品国产综合久久精品图片| 日韩和的一区二区| 欧美精品一区二区三区在线| 成人av影视在线观看| 亚洲国产精品人人做人人爽| 日韩免费电影网站| 9i在线看片成人免费| 亚洲一区二区综合| 久久综合五月天婷婷伊人| 成人午夜精品在线| 亚洲一区二区四区蜜桃| 欧美不卡激情三级在线观看| 成人av网站在线观看| 午夜亚洲福利老司机| 久久久影视传媒| 91久久一区二区| 久久91精品国产91久久小草| 国产精品国模大尺度视频| 欧美夫妻性生活| 国产成人h网站| 五月婷婷综合激情| 国产精品毛片高清在线完整版| 欧洲色大大久久| 国产精品一二三| 亚洲黄一区二区三区| 精品国内片67194| 91福利在线导航| 国产成人精品免费| 日韩主播视频在线| 亚洲欧美影音先锋| 精品国产成人系列| 欧美日韩国产另类一区| 粉嫩绯色av一区二区在线观看 | 精品国产乱子伦一区| 91麻豆视频网站| 国产成人精品一区二区三区四区| 亚洲动漫第一页| 中文字幕亚洲一区二区va在线| 日韩小视频在线观看专区| 日本韩国欧美一区| 懂色一区二区三区免费观看| 奇米精品一区二区三区在线观看| 亚洲天堂福利av| 国产亲近乱来精品视频| 欧美一级日韩免费不卡| 在线精品观看国产| 99免费精品视频| 国产成人在线视频播放| 久久99久久精品欧美| 日韩高清在线电影| 亚洲第一成人在线| 亚洲一区在线观看网站| 亚洲视频1区2区| 中文字幕中文字幕一区| 欧美国产激情二区三区 | 在线一区二区三区做爰视频网站| 国产成都精品91一区二区三| 精品中文字幕一区二区| 日韩av一二三| 免费看欧美美女黄的网站| 三级一区在线视频先锋| 视频一区在线播放| 午夜视频一区二区| 天堂久久久久va久久久久| 偷窥国产亚洲免费视频| 首页亚洲欧美制服丝腿| 视频精品一区二区| 久久综合综合久久综合| 日本一道高清亚洲日美韩| 日本色综合中文字幕| 视频一区二区国产| 久久99精品网久久| 国产乱妇无码大片在线观看| 国产福利91精品一区二区三区| 国产一区二区剧情av在线| 国产成人免费在线视频| 99re这里只有精品首页| 在线看国产一区二区| 欧美日韩国产综合草草| 欧美一区二区视频在线观看2020 | 久久精品99国产精品| 国内精品久久久久影院色| 国产福利一区在线观看| 97成人超碰视| 欧美日韩精品一区视频| 精品少妇一区二区三区视频免付费| 2021中文字幕一区亚洲| 国产精品青草综合久久久久99| 亚洲激情欧美激情| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产在线播放一区| 99re成人在线| 67194成人在线观看| 欧美精品一区男女天堂| 日韩伦理电影网| 丝袜脚交一区二区| 国产成人超碰人人澡人人澡| 色哟哟亚洲精品| 欧美va在线播放| 一色桃子久久精品亚洲| 亚欧色一区w666天堂| 国产激情91久久精品导航| 91精彩视频在线观看| 欧美一区欧美二区| 综合色天天鬼久久鬼色| 日本中文字幕一区| 99久久99久久免费精品蜜臀| 欧美丰满嫩嫩电影| 国产精品久久久久久妇女6080| 亚洲成av人片一区二区三区| 国产精品亚洲一区二区三区妖精| 欧美中文字幕一区二区三区亚洲 | 中文字幕国产精品一区二区| 亚洲va国产天堂va久久en| 国产成人av影院| 欧美精品丝袜中出| 最新热久久免费视频| 青青草国产成人99久久| 99综合影院在线| 久久久噜噜噜久久中文字幕色伊伊| 有码一区二区三区| 成人app软件下载大全免费| 在线综合视频播放| 一区二区三区四区在线免费观看| 激情六月婷婷综合| 欧美麻豆精品久久久久久| 中文字幕中文字幕一区| 国产主播一区二区三区| 7777女厕盗摄久久久| 一二三四社区欧美黄| 成人午夜私人影院| 26uuu精品一区二区三区四区在线| 亚洲va欧美va国产va天堂影院| www.av亚洲| 国产精品无码永久免费888| 美女脱光内衣内裤视频久久影院| 欧美熟乱第一页| 亚洲最大成人综合| 色一区在线观看| 国产精品二区一区二区aⅴ污介绍| 精品一区二区三区免费观看| 欧美一区二区视频在线观看2020| 夜夜揉揉日日人人青青一国产精品 | 日韩丝袜美女视频| 香蕉影视欧美成人| 欧美日韩一级二级三级| 一区二区三区国产精品| 97精品电影院| 一区二区三区欧美久久| 色先锋资源久久综合| 日韩一区欧美一区| 91在线一区二区| 亚洲男同性恋视频| 色国产精品一区在线观看| 亚洲天堂精品在线观看| 91行情网站电视在线观看高清版| 亚洲欧美日韩中文播放| 色悠久久久久综合欧美99| 亚洲一区二区三区视频在线播放 | 午夜伊人狠狠久久| 欧美日韩免费一区二区三区| 亚洲午夜视频在线观看| 欧美色老头old∨ideo| 亚洲第一精品在线| 欧美一区二区三区视频在线观看| 五月婷婷另类国产| 欧美成人性战久久| 国产精品自拍毛片| 中文字幕免费在线观看视频一区| 99视频精品在线| 亚洲aⅴ怡春院| 日韩欧美一级二级三级| 国产剧情一区二区| 亚洲欧美在线视频| 欧美精品在线一区二区| 久久国产精品区| 国产精品少妇自拍| 欧美日韩一区二区欧美激情| 日本欧美一区二区| 国产农村妇女毛片精品久久麻豆| av在线播放一区二区三区| 亚洲精品久久7777| 日韩一区二区三区电影在线观看| 韩国av一区二区三区在线观看| 国产精品久久久久久一区二区三区 | 欧美午夜宅男影院| 久久精品国产免费看久久精品|