PipedInputStream pio = new PipedInputStream(m_POO);
Tee teeOut = new Tee(System.out);
System.setOut(teeOut);
teeOut.add(new PrintStream(m_POO));
Reader reader = new InputStreamReader(pio);
m_OutRedirector = new ReaderToTextPane(reader, getOutput(), Color.BLACK);
m_OutRedirector.start();
}
catch (Exception e) {
System.err.println("Error redirecting stdout");
e.printStackTrace();
m_OutRedirector = null;
}
// Redirect System.err to the text area
try {
PipedInputStream pie = new PipedInputStream(m_POE);
Tee teeErr = new Tee(System.err);
System.setErr(teeErr);
teeErr.add(new PrintStream(m_POE));
Reader reader = new InputStreamReader(pie);
m_ErrRedirector = new ReaderToTextPane(reader, getOutput(), Color.RED);
m_ErrRedirector.start();
}
catch (Exception e) {
System.err.println("Error redirecting stderr");
e.printStackTrace();