Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

where can i find such textarea component which can display mixed different color text  RSS feed

 
rose deng
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
now i'm coding chat client applet.I want to display different color for different user's message.But for some reason,i can not use Swing package. And i know it's pretty difficult to code such component from scratch. So i want to know where i can find such component??
Thanks for your talent and kindness!!
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All components have a setForeground method. All TextComponents have a setBackground method.
Why not just use a TextArea.
TextArea message = new TextArea();
int r = 20; //any number from 1 to 256
int g = 256;
int b = 100;
Color userColor = new Color(r, g, b);
message.setBackground(userColor);
or (alternate syntax)
message.setForeground(new Color(28, 159, 200));
you can fiddle with the number combinations to get a whole bunch of shade variations.
Of course you would need a different TextArea for each message. You can't change the colors for just a PART of the text / background.

[This message has been edited by Cindy Glass (edited February 20, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!