What would be the best way to go about creating a countdown timer that shows
the user how much time he/she has to accomplish something, then do something
(call a method or set a flag) when the time has run out? Imagine an applet
with a clock counting down in one corner or another. Would you use a thread
to update the clock? Have it sleep for 250 or 500 or 1000 milliseconds then
calculate the remaining time and display it? If so, then how do you do the
repaint? Pass the JApplet to the thread so it can call repaint()? That seems
messy to me. Or maybe have the thread fire an event which the applet listens
for? I guess if I were going to do that, then I could just use one of the
Timer classes. I can make it work, but I'd like to get some input on clean
and efficient ways to go about it.
Steven T Abell - 24 Dec 2003 17:27 GMT
> What would be the best way to go about creating a countdown timer that shows
> the user how much time he/she has to accomplish something, then do something
[quoted text clipped - 7 lines]
> Timer classes. I can make it work, but I'd like to get some input on clean
> and efficient ways to go about it.
BTDT. Use Timer.
Steve
nos - 24 Dec 2003 19:22 GMT
> > What would be the best way to go about creating a countdown timer that shows
> > the user how much time he/she has to accomplish something, then do something
[quoted text clipped - 11 lines]
>
> Steve
and 1000 ms for the interval