import javax.swing.*; import java.awt.*; public class BattleApplet extends JApplet { private static final int FRAME_WIDTH = 520; private static final int FRAME_HEIGHT = 690; private static final int GRID_ROWS = 10; private static final int GRID_COLUMNS = 16; public BattleApplet () { JRootPane pane = getRootPane (); if (pane != null) { pane.putClientProperty ("defaultSystemEventQueueCheck", Boolean.TRUE); } } public void init () { Grid grid = new Grid (GRID_ROWS, GRID_COLUMNS); Simulator sim = new Simulator (FRAME_HEIGHT, FRAME_WIDTH, grid); Container content = getContentPane (); // Add classes to the simulation. sim.addClass ("HeavyInfantry"); sim.addClass ("LightInfantry"); sim.addClass ("ArcherInfantry"); sim.addClass ("Mercenary"); sim.addClass ("Maximus"); sim.addClass ("Wizard"); sim.addClass ("Blob"); sim.addTeam ("Red"); sim.addTeam ("Blue"); sim.addTeam ("Green"); sim.addTeam ("Black"); sim.addTeam ("White"); sim.addTeam ("Orange"); sim.addTeam ("Purple"); sim.addSpeed("Normal"); sim.addSpeed("Fast"); sim.addSpeed("Faster"); sim.addSpeed("Fastest"); if (content != null) { content.add (sim, BorderLayout.CENTER); } else { System.err.println ("ERROR: No content pane"); } Container pane = getContentPane (); if (pane != null) { pane.add (sim, BorderLayout.CENTER); } } }