public static void showResult(JTextArea txt, String result) {
   try {
     if (txt.getText().length() == 0) {
       txt.setText(result);
       txt.setSelectionStart(txt.getText().length());
       txt.setSelectionEnd(txt.getText().length() - 1);
     } else {
       if (txt.getText().length() > MAX_LOG_SIZE)
         txt.getDocument().remove(0, txt.getText().length() - MAX_LOG_SIZE);
       txt.setSelectionStart(txt.getText().length());
       txt.getDocument().insertString(txt.getText().length(), result, null);
       txt.setSelectionEnd(txt.getText().length());
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  @Override
  public void actionPerformed(ActionEvent e) {
    String prefix = "";
    String userName = settingsPane.returnSetting("IRC_nick");
    String input = "<b><font color=blue>[" + userName + "]:</font></b> " + chatInput.getText();

    if (e.getSource() == g_start) {

      substarterBegin(prefix, userName, input);
    }

    if (e.getSource() == g_end) {
      substarterEnd(prefix, userName, input);
    }

    if (e.getSource() == sendButton) {

      if (!chatInput.getText().equals("")) {

        // toChatScreen(input);

        // chatScreen.append(input + "\n");
        if (chatInput.getText().startsWith("/")) {
          if (chatInput.getText().equals("/substart")) {
            substarterBegin(prefix, userName, input);
          }
          if (chatInput.getText().equals("/substartend")) {
            substarterEnd(prefix, userName, input);
          }
        } else {
          sock.outputToChannel(chatInput.getText(), channelName);

          try {
            // chatter.printScreen();

            toChatScreen(prefix + input, false);
          } catch (IOException | BadLocationException ex) {
            Logger.getLogger(IRCBOT.class.getName()).log(Level.SEVERE, null, ex);
          }
        }
        chatInput.setText("");
        // chatter.addTo(input);

      } else {
        chatInput.setText("");
      }
      chatInput.requestFocus();
    }

    if (e.getSource() == settings) {
      // makeNewWindow("Window " + frameCounter, JFrame.DISPOSE_ON_CLOSE, 800, 500, 2);
      settingsPane.showPane();
    }
  }
  @Override
  public void keyReleased(KeyEvent e) {

    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
      String prefix = "";
      if (!chatInput.getText().equals("")) {
        String userName = settingsPane.returnSetting("IRC_nick");
        String input = "<b><font color=blue>[" + userName + "]:</font></b> " + chatInput.getText();

        // toChatScreen(input);

        // chatScreen.append(input + "\n");
        if (chatInput.getText().startsWith("/")) {
          if (chatInput.getText().equals("/substart")) {
            substarterBegin(prefix, userName, input);
          }
          if (chatInput.getText().equals("/substartend")) {
            substarterEnd(prefix, userName, input);
          }
        } else {

          try {
            // chatter.printScreen();

            toChatScreen(prefix + input, false);
          } catch (IOException | BadLocationException ex) {
            Logger.getLogger(IRCBOT.class.getName()).log(Level.SEVERE, null, ex);
          }
          sock.outputToChannel(chatInput.getText(), channelName);
        }
        chatInput.setText("");
        // chatter.addTo(input);

      } else {
        chatInput.setText("");
      }
      chatInput.requestFocus();
    }
  }