static class LogView extends JScrollPane { JTextPane textPane; *() { textPane = new JTextPane(); textPane.setEditable(false); setViewportView(textPane); } // thread safe public void logText(final String text) { awt { System.out.println("printing"); Document document = textPane.getDocument(); System.out.println("inserting"); document.insertString(document.getLength(), text, null); System.out.println("done printing"); // todo: scroll? } } // log some pure text and add a line feed // thread safe public void println(String line) { logText(line + "\n"); } // thread safe public void clear() { awt { textPane.setText(""); } } }