You'll have to create an implementation of PrintStream
and replace System.out
and System.err
with it, by System.setOut
and System.setErr
, respectively. You might also want to replace System.in
for input, depending on whether this is for the MineCraft client or server.
There are many articles on piping PrintStreams to Swing components. On such article describing the process can be found here. A search engine query resembling "redirecting PrintStream to JTextPane" will also bring up a handful of links.