Java Programming - null

Yesterday I asked about how to use JTextArea to allow different Color and Font for each line, and was directed to JEditorPane.

What I am doing is writing a chat client. So in the window where all the chat is printed, I want to be able to alternate Color and text for each line of text. So I try to use setText in JEditorPane and it is actually more unfriendly then append in JTextArea. It just overwrites the last entry with the new one, but the Font and color changes, for what little that is worth now.

So I used getText and appended that to the new string, and then called setText. Now it works exactly how JTextArea does. The entire text changes to the new Color and Font.

Not only that but now chat.setCaretPosition(chat.getDocument().getLength()); doesn't work very well. It does not force the the caret to move with the document allowing for autoscrolling.

Any more hints on how to reach my goals. The tutorial is supremely unhelpful as it doesn't have any dynamic examples for these classes.

[1032 byte] By [Rusty_Shackleforda] at [2007-11-26 23:25:08]
# 1
StyledDocument or something is what you need.And a good way to get your questions answered properly would be to post in the Swing forum.
CeciNEstPasUnProgrammeura at 2007-7-10 14:32:14 > top of Java-index,Java Essentials,Java Programming...