I changed the color of my button. Now I want its original look and feel back. I want to change the color once to a color that i like. After that, I want the button to get its original look back.
How do I do that ?
Here is the code to change color -
JButton but = JButton("Press now to up vote"); // :)
but.setBackground(Color.orange);
//code to remove this color and get the original look back ???
Color oldColor = myButton.getBackground();
myButton.setBackground(Color.RED);
// ... do stuff
myButton.setBackground(oldColor);
I want the button to get its original look back.
- this code should be only
button.setBackground(null);
Is there a way to find out the name/code of the old color
by default Colors
has not a names, only safe Colors(blue, red, orange ....)
old color
not JButton has arrays of Colors
UIManager returns javax.swing.plaf.ColorUIResource[r=xxx, g=xxx, b=xx]
, contains arrays of Colors
and Insets