Delaying a for loop until the task is completed
<p>I want to make a for loop wait until my other desired task is performed. In my case i want to validate a component within a loop and then increment the counter...</p>

<pre><code>for(int i = 1; i&lt;=56; i++)
    {
      jl.setIcon(new ImageIcon(ImageIO.read(new File("C:\\``Documents and Settings\\Prasad\\My Documents\\My Pictures\\"+Integer.toString(i)+".png"))));
      jl.revalidate();
    }
</code></pre>

<p>so here I want to open the images and validate the JLabel every time the loop runs. What happens is the images are loaded but the one displayed is only the last one. i.e. "56.png" the others are not!!!</p>

<p>So is there any solution to this?? Please help me!!
All help is appreciated...</p>
