0

i created a chat in java with jtext area.

when some one write a new message, the message appear in the chat in that form:

time username: message (example: 17:00 TheMan: Whats up)

My question is how can i change the font and add bold only in specific places in the text area ( the time and username) while leaving the rest as it was.

hope someone will be able to help.... tnx

Liran
  • 307
  • 1
  • 4
  • 11
  • Try JTextPane instead of JTextArea to change text style.(http://stackoverflow.com/questions/14400946/how-to-change-the-color-of-specific-words-in-a-jtextpane) – Sunil Singh Bora Feb 10 '14 at 15:24

1 Answers1

0

JTextArea supports simple plain text with simple styling only.

you may need to use JEditorPane or JTextPane instead of JTextArea.

Editor Panes and Text Panes

Salah
  • 8,567
  • 3
  • 26
  • 43