Here you can find the source of printStream(final JTextArea ta)
public static PrintStream printStream(final JTextArea ta)
//package com.java2s; //License from project: Apache License import java.io.*; import javax.swing.*; public class Main { public static PrintStream printStream(final JTextArea ta) { return new PrintStream(out(ta)) { public void println(String line) { ta.append(line + "\n"); }//from www . j av a 2s . c o m }; } public static OutputStream out(final JTextArea ta) { return new OutputStream() { public void write(int b) throws IOException { ta.append(String.valueOf((char) b)); } }; } }