He encontrado esta solución sencilla:
En primer lugar, usted tiene que crear una clase para reemplazar la salida estándar:
public class CustomOutputStream extends OutputStream {
private JTextArea textArea;
public CustomOutputStream(JTextArea textArea) {
this.textArea = textArea;
}
@Override
public void write(int b) throws IOException {
// redirects data to the text area
textArea.append(String.valueOf((char)b));
// scrolls the text area to the end of data
textArea.setCaretPosition(textArea.getDocument().getLength());
// keeps the textArea up to date
textArea.update(textArea.getGraphics());
}
}
A continuación, sustituir las normas de la siguiente manera:
JTextArea textArea = new JTextArea(50, 10);
PrintStream printStream = new PrintStream(new CustomOutputStream(textArea));
System.setOut(printStream);
System.setErr(printStream);
El El problema es que todas las salidas se mostrarán solo en el área de texto.
Fuente con una muestra: http://www.codejava.net/java-se/swing/redirect-standard-output-streams-to-jtextarea
Eso es increíble! :) – Roman