views:

161

answers:

1

I am working on a chat application and I want the user to be able to change their font while typing messages.

I tried using the setFont() method but it changes the font for the entire text within the JTextArea component and when the text is sent to the display area, another JTextArea component, the font changes do not appear. Instead it displays the text in the font of that set in the display area.

What I want to do is to change the font for either highlighted textarea or for the marker only and when the text is sent to the display area, the font changes should be evident.

+1  A: 

JTextArea supports simple plain text with simple styling only.

I'm having same problem, but seems the answer is that you should use JEditorPane or JTextPane instead of JTextArea.

Editor Panes and Text Panes

evilReiko