Reputation: 1594
I'm trying to simulate waiting in a java swing application, so it's basically like this: the user presses a button (Already added an actionlistener) then the program basically makes a 5 seconds pause while working in the background, then when the 5 seconds have elapsed a window shows up. ( I know how to make the window). Basically I'm asking how do you work with swing timers? Is there a command like pause() that can be invoked?
Upvotes: 4
Views: 1647
Reputation: 205875
You might get some ideas from TimerFrame
. See also Using Timers in Swing Applications.
Upvotes: 4
Reputation: 2111
you might want to check this example from the docs:
basically you can define an initial delay before it fires - in your case 5 seconds - and simply start it.
Upvotes: 2