Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Thread.sleep() in for loop

843785Sep 12 2008 — edited Sep 12 2008
Hi

I want to pause for a defined period of time per iteration of my for loop. I've tried using Thread.sleep(time) however this seems to just pause for a second and then do my entire loop, what gives?
  @Action  public void CycleElectrodeButtonPressed() throws InterruptedException {


for (int i = 0; i < 8; i++) 

     {

 cbarray.setSelected(true);
Thread.sleep(1000);

}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2008
Added on Sep 12 2008
14 comments
4,138 views