title: Java Thread.sleep() within a for loop
body: <pre><code>public void playPanel() throws IOException{
  
      for(int i = 0; i&lt;listData.size(); i++){
          try {
              Thread.sleep(1000L);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          ascii.setText(listData.get(i));
      }
  
  }
  </code></pre>
  
  <p>What I'm trying to do is play through the listData ArrayList type, which was copied from the ascii JTextArea. Its supposed to be an animation, so when they hit play the function displays the first slide, waits a second, then the next slide, etc. </p>
  
  <p>When I run this the only thing that happens is a pause with nothing on the screen changing until it displays only the final slide. I'm not sure what's wrong with it</p>