SRL Archive - Java Help and Tutorials

wait()?


omgh4x0rz

2007-04-24 19:53:35

Hey, does java have a wait() function like scar does? I couldn't find anything like that and it was kinda annoying. I made one pretty easily using currentTimeMillis, but I'm still wondering why I couldn't find anything built in.

p.s.
JCreator sucks bawlz!!!

Yakman

2007-04-25 03:39:18

you want the static method 'sleep' in the Thread class

so like
Thread.sleep(1000);

but it throws an exception which you have to catch

omgh4x0rz

2007-04-25 07:59:19

ah, thanks

ub3r |<1||3r*1337*

2007-04-27 22:39:56

And if you do not know the specific catch, it would be…

try {
thread.sleep(1000);
} catch(InterruptedException e) {
}

If you import the Robot class, (Java.awt.Robot), there is a wait procedure.