Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Grid {
- // Create a window showing an all-white empty grid with the
- // given number of rows and columns.
- // Individual squares are addressed with a row number in range 0 to rowCount-1
- // and a column number in range 0 to columnCount-1.
- public static void create (int rowCount, int columnCount);
- // Place an item on the given square, replacing any existing item.
- // Uses the default color Grid.BLACK for the new item.
- public static void placeItem (int row, int column, char item);
- // Place an item on the given square, replacing any existing item.
- // Uses the specified color Grid.… for the new item.
- public static void placeItem (int row, int column, char item, Color itemColor);
- // Removes any item from the given square.
- // Silently does nothing, if there is no item on that square.
- public static void removeItem (int row, int column);
- // Paint the background of the given square with specified color Grid.….
- // The previous background color is completely replaced with the new color.
- public static void paintFloor (int row, int column, Color floorColor);
- // A shortcut method to clear the background color of the given square to
- // the original color Grid.WHITE.
- public static void clearFloor (int row, int column);
- // Named constants for all predefined colors
- public static final Color BLACK = …;
- public static final Color WHITE = …;
- public static final Color GRAY = …;
- public static final Color RED = …;
- public static final Color GREEN = …;
- public static final Color BLUE = …;
- public static final Color YELLOW = …;
- public static final Color ORANGE = …;
- public static final Color CYAN = …;
- public static final Color VIOLET = …;
- public static final Color BROWN = …;
- // Predicate that tests whether the given row and column number refer to
- // a valid square inside the grid:
- // 0 <= row < rowCount AND 0 <= column < columnCount.
- // All other Grid methods abort the program with an error message,
- // if row or column numbers beyond the bounds of the grid are used.
- public static boolean insideBounds (int row, int column);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement