Version 2

Display something that actually looks like a Life board. Notice the use of the java.awt.Graphics methods setColor and fillOval. Notice also that the code does not check the size of the Applet, it just assumes that it is 200x200 pixels.

Top     Version 1     Version 3    

Source code:

import java.awt.*;
import java.applet.Applet;

public class Life extends Applet
{
  final int boardSize = 10;
  final int cellSize = 20;

  public void paint (Graphics g)
  {
    for (int i = 0; i < boardSize; i++) {
      for (int j = 0; j < boardSize; j++) {
        if ((i + j) % 3 == 0) // diagonal pattern
	  g.setColor (Color.blue);
	else
	  g.setColor (Color.white);
	g.fillOval (i * cellSize, j * cellSize, cellSize, cellSize);
      }
    }
  }
}