// Class: PersonTest // // Author: Joel Booth // // License Information: // This class is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation. // // This class is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. import java.awt.Color; import edu.kzoo.grid.BoundedGrid; import edu.kzoo.grid.Grid; import edu.kzoo.grid.Location; import edu.kzoo.grid.display.DisplayMap; import edu.kzoo.grid.gui.GridAppFrame; import edu.kzoo.util.NamedColor; /** * @author Joel Booth * @version 9 November 2004 **/ public class PersonTest { /** * Start the Test program. * The String arguments (args) are not used in this application. **/ public static void main(String[] args) { String TITLE = "Person Test"; Color BACKGROUND_COLOR = Color.WHITE; int MAX_WIDTH = 500; // in pixels int MAX_HEIGHT = 500; // in pixels int MIN_CELL_SIZE = 50; // in pixels // Construct a window to display a grid. GridAppFrame gui = new GridAppFrame(); gui.constructWindowContents(TITLE, BACKGROUND_COLOR, MAX_WIDTH, MAX_HEIGHT, MIN_CELL_SIZE); // Specify how to display color blocks. DisplayMap.associate("Person", new PersonDisplay()); // Construct a grid in which to draw. Grid grid = new BoundedGrid(10, 10); gui.setGrid(grid); // Add 3 people to the grid grid.add(new Person(), new Location(2, 2)); grid.add(new Person(NamedColor.MIDNIGHT), new Location(3, 5)); grid.add(new Person(NamedColor.MAGENTA), new Location(7, 7)); // Display the grid. gui.showGrid(); } }