Different text color in JTextArea
I am testing a application where I have a JTextArea. In that text area I want some text with black text and another text with red color(for error messages).
But when I change color at the text area it change the whole area(all text) and not the color I just set before I append the text.
In my method I check if it is a normal text or a error text and then I set the color for text area and then I append, next time I want append text to the area i set a new color and then append the text.
Is there any thing I can do to have text with different color in that text area?
I have search but dosent found any solution for this.