Search code examples
javaswingjframejtextarea

Append error message on jTextArea with different color


I was wondering if there is a way to append an error message in a jTextArea with different font color.

Like this it will make a difference between the normal output that I am appending and the error output.

For example, on Netbeans the system.err font color is red, and the System.out is appearing black.


Solution

  • JTextArea only allows a single color to be used. You can use a JTextPane instead