Sleeping

What is the import for the current method: Thread.sleep( 5000 );
[71 byte] By [ThunderCrashera] at [2007-11-26 22:20:59]
# 1
You don't need an import, it's in the java.lang package.
ignignokt84a at 2007-7-10 11:18:26 > top of Java-index,Java Essentials,Java Programming...
# 2
You will need to wrap it in a try catch or at least deal with the exception that it can throw.PS.
puckstopper31a at 2007-7-10 11:18:26 > top of Java-index,Java Essentials,Java Programming...
# 3

Okay, im still having trouble understanding this. Here's what I have and want to do:

if( health <= 0 ){

dead = 1;

g.setColor(Color.red);

g.drawString( "You are dead.", 135, 135 );

Thread.sleep(5000);

dispose();

}

I Want the JFrame to pause for 5 seconds, then exit.

Message was edited by:

ThunderCrasher

ThunderCrashera at 2007-7-10 11:18:26 > top of Java-index,Java Essentials,Java Programming...
# 4
I've never done try/catch so it is going to be more difficult for me to figure it out.
ThunderCrashera at 2007-7-10 11:18:26 > top of Java-index,Java Essentials,Java Programming...
# 5
If you haven't even got to error handling then you will probably not be able to handle the requirements for threaded GUI applications. Your code isn't anywhere near right. I will give you a link anyway: http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html
DrClapa at 2007-7-10 11:18:26 > top of Java-index,Java Essentials,Java Programming...