Saturday, 10 August 2013

ActionListener and Thread.sleep

ActionListener and Thread.sleep

I have a JButton, which, as soon as I click on it, I want to change some
colors after a few seconds, for example from blue -> 1 sec -> red -> 1 sec
-> yellow. My problem is that, as soon as I use the Thread.sleep function
in ActionListener and I test my program, it freezes for the 2 seconds and
gives me directly yellow. How can I fix that? Thanks a lot

No comments:

Post a Comment