views:

573

answers:

4

I am making a game and when I disable a button with setEnabled(false); the buttons turn grey which clashes with the other colors in the game. Is their a way to change the color of the button when it is disabled?

+1  A: 

You'll want to modify the Look and Feel you are using. There are tons available for download and you can of course make your own.

Nick Veys
A: 

You can also set a disable icon with JButton.setDisableIcon()

OscarRyz
A: 

i am not 100% on this, but i think you can overwrite the paint method of the button's glasspane to overlay it with the color of your choice.

here is a tutorial on the panes of a container:

http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html

clamp
Individual components don't have a glasspane. The glasspane is for the entire frame.
camickr
+2  A: 

If you are talking about the text, then you might be able to use the UIManager to change the disabled foreground color. Check out the UIManager Defaults.

camickr