import javax.swing.*;
import java.awt.*;

public class LifeSimulatorApplet extends JApplet {
	private static final int FRAME_WIDTH = 520;
	private static final int FRAME_HEIGHT = 590;
	private static final int GRID_ROWS = 30;
	private static final int GRID_COLUMNS = 30;

	public LifeSimulatorApplet() {
		JRootPane pane = getRootPane();

		if (pane != null) {
			pane.putClientProperty(
				"defaultSystemEventQueueCheck",
				Boolean.TRUE);
		}
	}

	public void init() {

		JFrame frame = new JFrame("Life Simulator");
		Grid grid = new Grid(30, 30);
		Simulator ca = new Simulator(FRAME_HEIGHT, FRAME_WIDTH, grid);
		Container content = getContentPane();

		// Add classes to the simulation.

		ca.addClass("Male");
		ca.addClass("Female");

		if (content != null) {
			content.add(ca, BorderLayout.CENTER);
		} else {
			System.err.println("ERROR: No content pane");
		}

		frame.pack();
		frame.show();
	}
}