Sketcher2 source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
617 B

package com.jotuntech.sketcher.common;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import javax.swing.JTextArea;
public class ConsoleOutputStream extends OutputStream {
JTextArea textArea;
public ConsoleOutputStream(JTextArea textArea) {
this.textArea = textArea;
PrintStream consolePrintStream = new PrintStream(this);
System.setOut(consolePrintStream);
System.setErr(consolePrintStream);
}
public void write(int ch) throws IOException {
textArea.append((char)ch + "");
textArea.setCaretPosition(textArea.getText().length());
}
}