• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding the textfield

 
narayana satish
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to color for the entire text field,i.e., if i type my text i should get in different color say red, blue or green.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can say
myText.setForeground(magenta);
myText.setForeground(new Color(120, 150, 244));
TextField inherit setForeground from Component and setBackground from TextComponent.
Class Color defines a bunch of ready made colors for you to use. Or you can feed in the numbers relating the the mix of red green and blue that you want (like the custom color setters in paint applications).
There are other contructors available if you read the API.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic