public void disConnect() {
   loginButton.setEnabled(true);
   userButton.setEnabled(true);
   connectButton.setEnabled(true);
   logoffButton.setEnabled(false);
   clientMessage.setEnabled(false);
   try {
     client.destory();
     messageShow.append("Has been disconnected from the server\n");
     type = 0;
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  public void init() {
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    loginButton = new RPCButton("Login");
    logoffButton = new RPCButton("Quit");
    userButton = new RPCButton("Set User");
    connectButton = new RPCButton("Set Connection");
    exitButton = new RPCButton("Exit UI");

    toolBar.setBackground(UIConfig.dialogbackground);
    toolBar.setBorder(new EmptyBarBorder());
    toolBar.add(userButton);
    toolBar.add(connectButton);
    toolBar.addSeparator();
    toolBar.add(loginButton);
    toolBar.add(logoffButton);
    toolBar.addSeparator();
    toolBar.add(exitButton);
    contentPane.add(toolBar, BorderLayout.NORTH);
    checkbox = new RPCheckBox("Secret");
    checkbox.setBackground(UIConfig.dialogbackground);
    checkbox.setSelected(false);
    actionlist = new RPComboBox();
    actionlist.addItem("O(∩_∩)O");
    actionlist.addItem(">_<|||");
    actionlist.addItem("⊙﹏⊙‖");
    actionlist.addItem("→_→");
    actionlist.addItem("…(⊙_⊙;)…");
    actionlist.addItem("( ^_^ )?");
    actionlist.setSelectedIndex(0);

    loginButton.setEnabled(true);
    logoffButton.setEnabled(false);

    loginButton.addActionListener(this);
    logoffButton.addActionListener(this);
    userButton.addActionListener(this);
    connectButton.addActionListener(this);
    exitButton.addActionListener(this);
    combobox = new RPComboBox();
    combobox.insertItemAt("all", 0);
    combobox.setSelectedIndex(0);
    messageShow = new RPTextArea();
    messageShow.setEditable(false);

    messageScrollPane =
        new JScrollPane(
            messageShow,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    messageScrollPane.setPreferredSize(new Dimension(400, 400));
    messageScrollPane.revalidate();

    clientMessage = new RPTextBox(23);
    clientMessage.setEnabled(false);
    clientMessageButton = new RPCButton();
    clientMessageButton.setText(UIMessage.send);
    clientMessageButton.setFont(UIRes.getFont());

    clientMessage.addActionListener(this);
    clientMessageButton.addActionListener(this);
    sendToLabel = new RPLabel("Send To:");
    express = new RPLabel("Face:");
    messageLabel = new RPLabel("Message:");
    downPanel = new JPanel();

    downPanel.setPreferredSize(new Dimension((int) faceSize.getWidth(), 155));
    downPanel.setLayout(null);

    downPanel.add(sendToLabel);
    sendToLabel.setBounds(10, 5, 70, 30);

    downPanel.add(combobox);
    combobox.setBounds(80, 5, 90, 30);

    downPanel.add(express);
    express.setBounds(190, 5, 90, 30);

    downPanel.add(actionlist);
    actionlist.setBounds(240, 5, 110, 30);

    downPanel.add(checkbox);
    checkbox.setBounds(5, 35, 70, 30);

    downPanel.add(messageLabel);
    messageLabel.setBounds(10, 65, 70, 30);

    downPanel.add(clientMessage);
    clientMessage.setBounds(80, 65, (int) faceSize.getWidth() - 90, 30);

    downPanel.add(clientMessageButton);
    clientMessageButton.setBounds(80, 115, 90, 30);

    contentPane.add(messageScrollPane, BorderLayout.CENTER);
    contentPane.add(downPanel, BorderLayout.SOUTH);
    messageScrollPane.setBackground(UIConfig.dialogbackground);
    downPanel.setBackground(UIConfig.dialogbackground);

    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            if (type == 1) {
              disConnect();
            }
            SwingUtils.close(RPChatClientDialog.this);
          }
        });
  }