Hi I am working on a chat program. I am appending the messages to a TextArea in an applet. I want to show the messages in different colors as they are appended to the text area. If I call setForeground for the textarea, the messages already appended to the textarea are changed to the new color. How can I prevent this and show only the message that is appended after calling setForeground()be shown in that color? Is there any other way? Please help...urgent Thanks, Elizabeth
Helmut Lerch
Ranch Hand
Joined: Feb 11, 2001
Posts: 48
posted
0
Originally posted by Elizabeth Luckose: Hi I am working on a chat program. I am appending the messages to a TextArea in an applet. I want to show the messages in different colors as they are appended to the text area. If I call setForeground for the textarea, the messages already appended to the textarea are changed to the new color. How can I prevent this and show only the message that is appended after calling setForeground()be shown in that color? Is there any other way? Please help...urgent Thanks, Elizabeth
Since you mention TextArea I assume you are using AWT. You can't color parts of the Text differently within TextArea. You have to use swing or write your own component. Heli