orange
orange

Reputation: 5405

Decorating JTextArea

I'm appending text to a text area using .append method, I've been trying to make the text which gets appended bold and also change colour.

Is this not possible with JTextArea area, I only want one line to be bold and a different colour and the rest the default font.

Do I need to use something other than JTextArea?

Upvotes: 2

Views: 1110

Answers (2)

nIcE cOw
nIcE cOw

Reputation: 24626

For having different lines/words/characters with different Font or colour setting you need either JTextPane or JEditorPane, How to Use Editor Panes and Text Panes.

In JTextArea, the whole document is bound to have one single setting in terms of FONT or COLOUR.

Hope this might help.

Regards

Upvotes: 4

Hauke Ingmar Schmidt
Hauke Ingmar Schmidt

Reputation: 11607

JTextArea is for plain text. JTextPane can show attributed text.

Upvotes: 3

Related Questions