!747 !actionListener { !721 // thread { !x1000805 // awt { main { static LogView logView; !include #1000820 // LogView psvm { awt { JFrame frame = new JFrame("LogView Test"); logView = new LogView; redirectStdOutAndErrTo(logView); //logView.println("Hello Agnes"); //logView.println("Hello Julia"); frame.add(logView); frame.setBounds(100, 100, 500, 400); print("Showing"); frame.setVisible(true); exitOnFrameClose(frame); print("Done showing"); logView.println("Hello Julia"); print("yup"); } } static void redirectStdOutAndErrTo(final LogView lg) { OutputStream outputStream = new OutputStream() { public void write(int b) { try { lg.print(new String(new byte[] {(byte) b}, "UTF-8")); // This is crap } catch (UnsupportedEncodingException e) {} } @Override public void write(byte[] b, int off, int len) { try { lg.print(new String(b, off, len, "UTF-8")); // This is crap } catch (UnsupportedEncodingException e) {} } }; PrintStream ps = new PrintStream(outputStream, true); System.setOut(ps); System.setErr(ps); } }