File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes regarding the textfield Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "regarding the textfield" Watch "regarding the textfield" New topic
Author

regarding the textfield

narayana satish
Greenhorn

Joined: Dec 21, 2000
Posts: 25
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

Joined: Sep 29, 2000
Posts: 8521
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.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding the textfield
 
Similar Threads
How to change the color of text-decoration:line-through to red instead of black?
jar in Jdk 1.7
how to write color text in text file
ListBox
FTP upload