Link to home
Start Free TrialLog in
Avatar of flo_the_lil_minx
flo_the_lil_minxFlag for United Kingdom of Great Britain and Northern Ireland

asked on

JButton getColor?

Hi,

I want to write some code that will change the color of a button with a mouseEntered.  I can change the color ok but I want it to return to it's original color on the mouseExited event.

I thought I could create a new variable using

Color orig;

orig = b1.getColor     (b1 being the name of one of my button variables)

Unfortunately this doesn't work. How can I save the original color of the button so I can revert back to it on mouseExited?

tia Flo
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of flo_the_lil_minx

ASKER

I'm sorry, I don't understand?
orig needs to be a member var (and not a local var)
I got it

I should've used

orig = b1.getBackground();

instead of

orig = b1.getColor();

Thanks for your help