/** * Sets the token maker factory used by this document. * * @param tmf The <code>TokenMakerFactory</code> for this document. If this is <code>null</code>, * a default factory is used. */ public void setTokenMakerFactory(TokenMakerFactory tmf) { tokenMakerFactory = tmf != null ? tmf : TokenMakerFactory.getDefaultInstance(); }
/** * 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(); }
/** * Sets the syntax style being used for syntax highlighting in this document. What styles are * supported by a document is determined by its {@link TokenMakerFactory}. By default, all <code> * RSyntaxDocument</code>s support all languages built into <code>RSyntaxTextArea</code>. * * @param styleKey The new style to use, such as {@link SyntaxConstants#SYNTAX_STYLE_JAVA}. If * this style is not known or supported by this document, then {@link * SyntaxConstants#SYNTAX_STYLE_NONE} is used. */ public void setSyntaxStyle(String styleKey) { boolean wsVisible = isWhitespaceVisible(); tokenMaker = tokenMakerFactory.getTokenMaker(styleKey); tokenMaker.setWhitespaceVisible(wsVisible); updateSyntaxHighlightingInformation(); }