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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chatarea.java~970~

?? 1. 消息即時通信 2. 消息發送實現一對一、一對多等多種發送模式 3. 發送的消息實現多彩文本編輯
?? 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:客戶端主界面,包括消息編輯,消息查看,文件發送,文件接收,在線列表 </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();
  //自動回復菜單事件對象
  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);
  //自動回復控制變量
  static private int REVERTOPTION = 0;
  //自動回復信息
  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"));

  //發送文件處理按鈕對象
  FileDisposeButton fb;
  //登錄對話框對象
  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();

  //自動回復菜單和菜單項
  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用于用戶列表動態添加數據
  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劈開面板用于放置現在用戶列表和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();

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

  JButton clearSendObjectButton = new JButton();

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


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

  //存儲發送對象的向量對象
  Vector toPeople = new Vector();
  String selectName = "";
  //存儲發送對象的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 {

    //設置系統默認的字體
    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);

    }

    //初始狀態設置
    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);
    //設置菜單和菜單顯示文本
    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發送消息
    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);

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

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

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

    publicChat.setContentType("text/html");


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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩国产综合在线| 91精品国产综合久久久久久漫画 | 51精品久久久久久久蜜臀| 成人免费毛片高清视频| 777久久久精品| 欧美日韩高清在线播放| 日韩视频一区在线观看| 91精品欧美久久久久久动漫 | 丁香一区二区三区| 亚洲乱码国产乱码精品精小说 | 精品午夜久久福利影院| 国产精品欧美一级免费| 7777精品伊人久久久大香线蕉的 | 国产性做久久久久久| 色综合久久久久久久久久久| 午夜激情综合网| 国产日韩欧美激情| 在线视频一区二区免费| 极品尤物av久久免费看| 亚洲精品视频自拍| 久久久精品日韩欧美| 欧美三级资源在线| 国产99久久久国产精品潘金| 无码av免费一区二区三区试看 | 福利电影一区二区| 亚洲国产精品久久不卡毛片| www日韩大片| 色悠悠久久综合| 国产黄色91视频| 美女性感视频久久| 亚洲男人的天堂在线观看| 久久久综合视频| 91精品免费观看| 天天综合色天天综合| 亚洲视频一二三区| 久久久久久久久伊人| 777久久久精品| 色偷偷88欧美精品久久久| 精品一区二区综合| 视频一区国产视频| 国产精品国产三级国产普通话三级 | 久久美女艺术照精彩视频福利播放 | 午夜一区二区三区视频| 国产成人日日夜夜| 国产精品久久久久久久久免费丝袜| 99在线精品免费| 日韩欧美国产wwwww| av成人老司机| 狠狠色伊人亚洲综合成人| 轻轻草成人在线| 午夜免费欧美电影| 丝袜美腿成人在线| 亚洲高清不卡在线| 婷婷中文字幕一区三区| 亚洲一区在线观看免费 | 国产丝袜美腿一区二区三区| 日韩欧美一区二区三区在线| 欧美一区二区三区啪啪| 精品成人a区在线观看| 日韩久久精品一区| 国产欧美一区二区精品性| 久久久久亚洲蜜桃| 亚洲人成网站色在线观看| 亚洲欧洲综合另类| 国产精品成人一区二区艾草| 一区二区理论电影在线观看| 一区二区三区中文免费| 日本网站在线观看一区二区三区 | 欧美精品一区二区三区在线| 欧美精品一区二区三区一线天视频 | 奇米影视一区二区三区小说| 日本特黄久久久高潮| 美女网站色91| 另类欧美日韩国产在线| 久久黄色级2电影| 99视频精品全部免费在线| 91免费在线看| 精品免费国产二区三区| 久久久精品影视| 亚洲国产成人porn| 久久成人免费电影| 99国产欧美另类久久久精品| 欧美日韩一区在线| 欧美v日韩v国产v| 91热门视频在线观看| 久久久精品欧美丰满| 中文无字幕一区二区三区| 欧美成人精品1314www| 91精品国产手机| 久久久久久麻豆| 国产三级精品在线| 亚洲精品在线观| 国产三级一区二区| 性感美女久久精品| 日韩一级二级三级精品视频| 在线一区二区视频| 884aa四虎影成人精品一区| 国产精品视频yy9299一区| 一区二区三区高清| 麻豆国产一区二区| 欧美唯美清纯偷拍| 精品国产一区二区三区不卡 | 悠悠色在线精品| 丝袜国产日韩另类美女| www.亚洲激情.com| 欧美裸体一区二区三区| 综合色天天鬼久久鬼色| 另类小说图片综合网| 欧美日韩成人一区| 国产精品毛片大码女人| 日本vs亚洲vs韩国一区三区二区| 成人国产视频在线观看| 久久久99免费| 午夜私人影院久久久久| 91麻豆文化传媒在线观看| 久久精品亚洲麻豆av一区二区| 亚洲日本va午夜在线电影| 国产99精品国产| 欧美日韩高清不卡| 日韩美女视频一区| 韩国毛片一区二区三区| 欧美无乱码久久久免费午夜一区| 亚洲免费观看高清在线观看| 国产一区视频网站| 久久久久成人黄色影片| 日韩电影在线观看电影| 欧美另类高清zo欧美| 亚洲欧美电影院| 美女免费视频一区| 日韩小视频在线观看专区| 亚洲综合色在线| 欧美日韩精品欧美日韩精品一| 国产精品欧美一级免费| 99这里只有精品| 久久久久国产精品人| 国产高清精品久久久久| 欧美tickling网站挠脚心| 国产一区二区三区免费看| 欧美一区二区三区视频在线| 中文字幕在线观看一区二区| 成人性视频网站| 久久久亚洲精品石原莉奈| 国产福利一区在线观看| 国产欧美日韩不卡| av在线播放一区二区三区| 韩国成人在线视频| 粉嫩欧美一区二区三区高清影视| 久久精品亚洲国产奇米99| www.亚洲在线| 亚洲成av人片观看| 欧美成人aa大片| 丁香激情综合国产| 午夜影院久久久| 26uuu色噜噜精品一区二区| 丁香亚洲综合激情啪啪综合| 亚洲激情校园春色| caoporen国产精品视频| 日韩一区二区三区三四区视频在线观看| 亚洲国产一区二区视频| 欧洲精品在线观看| 免费看黄色91| 欧美xxxx在线观看| 国产成人亚洲精品青草天美| 久久精品夜色噜噜亚洲a∨| 成人高清伦理免费影院在线观看| 欧美极品少妇xxxxⅹ高跟鞋| 成人精品免费看| 中文字幕制服丝袜成人av| 91网址在线看| 亚洲精品国产视频| 久久99热99| 亚洲欧美中日韩| 色婷婷国产精品综合在线观看| 亚洲午夜精品网| 欧美一区二区三区日韩视频| 国产福利不卡视频| 国产精品久久久久国产精品日日| 不卡一区中文字幕| 亚欧色一区w666天堂| 日韩精品影音先锋| 一本在线高清不卡dvd| 亚洲一区二区三区三| 宅男在线国产精品| 日韩av不卡在线观看| 成人精品免费视频| 91免费版在线看| 日韩视频免费观看高清完整版在线观看 | 国产精品美女视频| av在线不卡电影| 蜜桃视频在线观看一区| 国产亚洲精久久久久久| 欧美日韩国产在线观看| 久久99日本精品| 国产午夜精品久久久久久久| 99re成人精品视频| 亚洲一区二区四区蜜桃| 国产欧美精品日韩区二区麻豆天美| 《视频一区视频二区| 国产成人精品免费网站| 精品国产乱码久久|