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

public class CrawlApplet extends JApplet {
	//  OVERVIEW:  Sets up and controls the simulation of 
	//  Corner Crawl at UVa.

	private static final int FRAME_WIDTH = 520;
	private static final int FRAME_HEIGHT = 590;

	public CrawlApplet() {
	    JRootPane pane = getRootPane();
	    
	    if (pane != null) {
		pane.putClientProperty(
				       "defaultSystemEventQueueCheck",
				       Boolean.TRUE);
	    }
	}
    
    public void init() {
	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("Crawler");
	ca.addClass("Bank");
	ca.addClass("Bar");
	ca.addClass("Home");
	ca.addClass("Food");
	ca.addClass("Police");
	ca.addClass("Townies");
	ca.addClass("Students");
	
	if (content != null) {
	    content.add(ca, BorderLayout.CENTER);
	} else {
	    System.err.println("ERROR: No content pane");
	}
	
	// content.pack();
	content.show();
    }
}
//Modeled after Simulater.java (PS5) and the simulator class of "Saturday Night"