add time delay

I have a script that I added a time delay which worked. I then tried to add a second time delay and cannot get this to work. The NO_OPTION in bold is where I am having a problem. If I select no here I would like to skip over the try section in italics then continue with the rest of the script. Is this possible? Thanks!

try {

long numMillisecondsToSleep = 8000; // 8 seconds

Thread.sleep(numMillisecondsToSleep);

} catch (InterruptedException e) {

}

int response = JOptionPane.showConfirmDialog(null,"Do you need more time?",

"Production Promote",

JOptionPane.YES_NO_OPTION,

JOptionPane.INFORMATION_MESSAGE);

if (response == JOptionPane.NO_OPTION) {

} else if (response == JOptionPane.YES_OPTION) {

try {

long numMillisecondsToSleep = 8000; // 8 seconds

Thread.sleep(numMillisecondsToSleep);

} catch (InterruptedException e) {

}

int response1 = JOptionPane.showConfirmDialog(null," You are about to promote selected\n objects in commonspace to production.\nAre you sure?",

"Production Promote",

JOptionPane.YES_NO_OPTION,

JOptionPane.INFORMATION_MESSAGE);

if (response1 == JOptionPane.NO_OPTION) {

} else if (response1 == JOptionPane.YES_OPTION) {

IL.openWindow( "Promote", "", "" ); // recorded step: 1

IL.setAttribute( "Promote To", "Production" ); // recorded step: 2

IL.deselectAll( "PIV" ); // recorded step: 3

}

}

}

} // End of run0

[1543 byte] By [bfairhura] at [2007-11-26 17:55:00]
# 1

No need for else there

//...

if (response == JOptionPane.YES_OPTION)

{

// sleep

}

//...

duckbilla at 2007-7-9 5:08:07 > top of Java-index,Desktop,Core GUI APIs...
# 2
I removed the NO_OPTION. When I select no on the confirm dialog with the no option removed the script just stops and does not continue. When I select no here I would like the script just to jump over the time delay but continue with the rest of the script.
bfairhura at 2007-7-9 5:08:07 > top of Java-index,Desktop,Core GUI APIs...
# 3

Make sure you have the rest of the code out of the if-block

//...

if (response == JOptionPane.YES_OPTION)

{

try { Thread.currentThread().sleep(8000); }

catch (InterruptedException e) {}

}

//...

duckbilla at 2007-7-9 5:08:07 > top of Java-index,Desktop,Core GUI APIs...
# 4
Thanks! that did the trick.
bfairhura at 2007-7-9 5:08:07 > top of Java-index,Desktop,Core GUI APIs...