Link to home
Start Free TrialLog in
Avatar of prain
prainFlag for United States of America

asked on

How to blink a JButton

This is what I need to do....

I have a JButton in notmal state (No Blink).
 I click on it.
 It starts blinking.
Now it blinks.
I Click on it.
Stops Blinking and goes back to the normal state (Non Blink)

How to blink a button?
Avatar of sciuriware

Many ways.
I made one by showing 2 different icons when it is clicked.
I'm using a Swing timer that has the same 'actionPerformed()' in the class.
I'm not going to post all code, you can imagine how
to implement a timer with a boolean that's flipped true/false and 'decides'
what icon to set on the button.

Avatar of sciuriware

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And after the first click:


The rest is easily guessed.