title: Creating a color-changing grid applet in Java
body: <p>For a school project, I need to create an applet that produces a 10 x 10 grid in which each cell will change color in accordance to what some threads are doing in the background. I have all of the rest figured out, but I don't have the slightest clue as to how to display this grid. This is the only example code we were given:</p>
  
  <pre><code>import java.awt.*;
  import java.applet.Applet;
  
  public class Array2 extends Applet {
    private final ststic int LIMIT = 9;
    private int[][] results;
  
    public void init() {
      int count = 1;
      results = new int [LIMIT][LIMIT];
  
      for (int i = 0; i &lt; LIMIT; i++) {
        for (int j = 0; j &lt; LIMIT; j++) {
          results[i][j] = count % 2;
          count++;
        }
      }
    }
  
    public void paint (Graphics g) {
      int xLoc = 25;
      int yLoc = 25;
  
      for (int i = 0; i &lt; LIMIT; i++) {
        for (int j = 0; j &lt; LIMIT; j++) {
          g.drawString(Integer.toString(results[i][j]), xLoc. yLoc);
          xLoc += 20;
        }
        xLoc = 25;
        yLoc += 20;
      }
    }
  }
  </code></pre>
  
  <p>This ends up printing a blank 2 x 2 grid. This is easy enough to modify into a 10 x 10. However, what I DON'T know how to do is color the squares. Everything I've searched mentions using jPanels or jFrames or something, but this HAS to be an applet. I was just looking for some suggestions as to what I should look into for the coloring process, as this is literally all I have to go on.Thanks!</p>