• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it possible to change JTextArea color method by method?

 
Maduranga Liyanage
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a JTextArea and I have changed the font color by TArea.setForeground(Color.white);

I was wondering if I can change the color within methods. For example one method prints (TArea.append(...)) in red and another method prints in blue.

I tried with putting different .setForeGroundColor but seems it is not workin.

Is there a proper way of doing this?

Thank you.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Is there a proper way of doing this?

JTextPane
 
Maduranga Liyanage
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael.
Will look into that.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at these old threads, maybe they will be of use: 1 2 3 4.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!