Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > simple stuff in swing

Thread Tools

simple stuff in swing

Posts: n/a
While I was gone i realised i only need this loop:

public static void Reminder(int seconds) {
while(i < 31) {
o = i;
timer.schedule(new RemindTask(), seconds*1000);
while(o == i) {}


I couldn't actually figure out how to implement Thread's sleep method
into this programme. Maybe someone could help...

Reply With Quote
Roedy Green
Posts: n/a
On 6 Nov 2005 12:05:37 -0800, "defcon8" <(E-Mail Removed)> wrote,
quoted or indirectly quoted someone who said :

>I couldn't actually figure out how to implement Thread's sleep method
>into this programme. Maybe someone could help...

The basic technique is this. You set up your timer then return in the
main method. Or in an event handler you set up your timer and return.
The timer then does its thing all on its own. It wakes up your code
periodically which does something then exits. You don't need a
babysitting task to worry. The Timer does that.
Canadian Mind Products, Roedy Green. Java custom programming, consulting and coaching.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing is dead! Long live Swing. Knute Johnson Java 32 02-29-2012 05:10 PM
Why not using javax.swing.event with swing? S.T Java 2 05-25-2007 12:10 AM
javax.swing.Popup, javax.swing.PopupFactory lizard Java 0 01-30-2006 09:34 PM
Swing Model Classes Updating Swing Components on a Thread Other Than AWT mkrause Java 0 05-06-2005 04:32 PM
Java 1.2 Swing vs. Java 1.5 Swing Big Daddy Java 2 04-16-2005 01:14 PM