This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Changing Text Color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Changing Text Color" Watch "Changing Text Color" New topic
Author

Changing Text Color

james wilson
Greenhorn

Joined: Nov 17, 2001
Posts: 15
Maybe i'm being a bit slow, but is there anyway of changing the text colour of components. And in the case of buttons changing the background colour, or even using a image as the button.
Thanks in advance
James Wilson
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
All components (including Buttons) inherit the setForeground(Color c) and setBackgroung(Color c) methods from Component.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Here is a thread that describes putting an image on a Button.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
setForeground( Color.blue )
setBackground( Color.white )
Check out Sun's JButton tutorial

------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
Co-author Mike Meyers' Java 2 Certification Passport


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Changing Text Color