Avatar of prain
prain
Flag 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?
Java

Avatar of undefined
Last Comment
sciuriware

8/22/2022 - Mon
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.

;JOOP!
ASKER CERTIFIED SOLUTION
sciuriware

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
sciuriware

And after the first click:

         blinker.start();

The rest is easily guessed.
;JOOP!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck