I am developing a Java Desktop Application. In it I have 4 JButtons
on a JPanel
. Now I want that whenever a button is clicked its background color
You can get the standard background color for buttons from the UIManager:
button1.setBackground(UIManager.getColor("Button.background"));
As far as I know, the keys could change in different look & feels. Here is a nice webstart app that shows all available keys:
http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/