Avatar of 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?

Avatar of undefined
Last Comment

8/22/2022 - Mon

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.


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
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

And after the first click:


The rest is easily guessed.
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