Now I have a code that looks something like this:
Timer timer = new javax.swing.Timer(5000, myActionEvent);
According to what I see (and Javadocs for the Timer class , the timer will wait 5,000 milliseconds (5 seconds), fire an action event, wait 5,000 milliseconds, fire again, etc. However, the behavior I'm trying to get, is that the timer starts, the event fires, the timer waits 5,000 milliseconds, fires again, and then waits before firing again.
If I missed something, I see no way to create a timer that does not wait until it starts. Is there a good, clean way to emulate this?
source share