/**
   * ERROR (exceptions) WARN (when something happens that's not supposed to) INFO (wire output)
   * DEBUG (test/displaying intermediate values), TRACE (start/end method)
   */
  public ConnectionConsoleWindow(ToolBar toolBar) {
    final ConnectionConsoleWindow thisConsole = this;
    this.toolBar = toolBar;

    java.net.URL url = ClassLoader.getSystemResource("ethereum-icon.png");
    Toolkit kit = Toolkit.getDefaultToolkit();
    Image img = kit.createImage(url);
    this.setIconImage(img);
    addCloseAction();

    JPanel cp = new JPanel(new BorderLayout());

    AbstractTokenMakerFactory atmf =
        (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
    atmf.putMapping("text/console", "org.ethereum.gui.ConsoleTokenMaker");

    textArea = new RSyntaxTextArea(16, 44);
    textArea.setSyntaxEditingStyle("text/console");
    //        textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_LISP);
    textArea.setCodeFoldingEnabled(true);
    textArea.setAntiAliasingEnabled(true);

    changeStyleProgrammatically();
    RTextScrollPane sp = new RTextScrollPane(textArea);

    cp.add(sp);

    setContentPane(cp);
    setTitle("Connection Console");
    //        setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    setLocation(802, 460);

    if (CONFIG.peerDiscovery()) UIEthereumManager.ethereum.startPeerDiscovery();

    Thread t =
        new Thread() {
          public void run() {

            UIEthereumManager.ethereum.connect(
                SystemProperties.CONFIG.activePeerIP(), SystemProperties.CONFIG.activePeerPort());
          }
        };

    UIEthereumManager.ethereum.addListener(
        new EthereumListenerAdapter() {
          @Override
          public void trace(final String output) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    textArea.append(output);
                    textArea.append("\n");

                    if (autoScroll) textArea.setCaretPosition(textArea.getText().length());
                  }
                });
          }
        });
    t.start();
  }