Change font color when appending text
Hi,
I would like to change the font color of the text when I append it to a textarea. I have a textarea listening to two incoming messages that print in the textarea. Basically each text needs to be in different color so they can be distinguished from each sender.
Thanks
Dilip
[302 byte] By [
pateldwa] at [2007-9-30 2:23:46]

You can't use a JTextArea for this, you should use a JTextPane. Read this section from the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/text.html]Using Text Components[/url] for more information.
And here's a [url http://forum.java.sun.com/thread.jsp?forum=57&thread=342068]thread[/url] to get you started.
> not sure I understand using textpane attributes?
You've given up after spending 5-10 minutes on reading about textpane attributes? You where also given a working program. I've given you what I believe is the easiest solution.
If you want to use HTML then you need to use a JEditorPane. There are many questions in the forum about Chat Applications wanting to use different color text. Search the forum and Good Luck!