title: To Add a Timer to paint
body: <p>my program currently reads from a text file and paints different coloured circles depending on the next value in the array. at the moment i am reading the first 10 values in the array so there should be 10 painted circles. These circles all paint at the same time, but i want them to paint one by one, so for example a two second interval between each painted circle. The code below is the section which does the reading of the values and the painting of the circles. can someone please help me. Im very confused on where and how to add the timer.</p>
  
  <pre><code>public void paintComponent(Graphics g) {
          drawShapes(g, circlesT);
      }
  
      public void drawShapes(Graphics g, ArrayList&lt;Shape&gt; circlesT) {
          Graphics2D ga = (Graphics2D) g;
          ga.drawImage(newImage, 0, 0, null);
  
  
  
          for (int i = 0; i &lt; circlesT.size(); i++) {
              ga.draw(circlesT.get(i));
              ga.setPaint(Color.white);
              ga.fill(circlesT.get(i));
          }
  
  
          for (int i = 0; i &lt; 10; i++) {
  
  
              if (read.temp.get(i) &lt; 31 &amp;&amp; read.temp.get(i) &gt; 30) {
                  ga.draw(circlesT.get(i));
                  ga.setPaint(Color.green);
                  ga.fill(circlesT.get(i));
              } else if (read.temp.get(i) &lt; 32 &amp;&amp; read.temp.get(i) &gt; 31) {
                  ga.draw(circlesT.get(i));
                  ga.setPaint(Color.red);
                  ga.fill(circlesT.get(i));
              } else if (read.temp.get(i) &lt; 33 &amp;&amp; read.temp.get(i) &gt; 32) {
                  ga.draw(circlesT.get(i));
                  ga.setPaint(Color.yellow);
                  ga.fill(circlesT.get(i));
              }
          }
  
      }
  </code></pre>