Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. public class Grid {
  2.  
  3. // Create a window showing an all-white empty grid with the
  4. // given number of rows and columns.
  5. // Individual squares are addressed with a row number in range 0 to rowCount-1
  6. // and a column number in range 0 to columnCount-1.
  7. public static void create (int rowCount, int columnCount);
  8.  
  9. // Place an item on the given square, replacing any existing item.
  10. // Uses the default color Grid.BLACK for the new item.
  11.  
  12. public static void placeItem (int row, int column, char item);
  13.  
  14. // Place an item on the given square, replacing any existing item.
  15. // Uses the specified color Grid.… for the new item.
  16.  
  17. public static void placeItem (int row, int column, char item, Color itemColor);
  18.  
  19. // Removes any item from the given square.
  20. // Silently does nothing, if there is no item on that square.
  21.  
  22. public static void removeItem (int row, int column);
  23.  
  24. // Paint the background of the given square with specified color Grid.….
  25. // The previous background color is completely replaced with the new color.
  26.  
  27. public static void paintFloor (int row, int column, Color floorColor);
  28.  
  29. // A shortcut method to clear the background color of the given square to
  30. // the original color Grid.WHITE.
  31.  
  32. public static void clearFloor (int row, int column);
  33.  
  34. // Named constants for all predefined colors
  35. public static final Color BLACK = …;
  36. public static final Color WHITE = …;
  37. public static final Color GRAY = …;
  38. public static final Color RED = …;
  39. public static final Color GREEN = …;
  40. public static final Color BLUE = …;
  41. public static final Color YELLOW = …;
  42. public static final Color ORANGE = …;
  43. public static final Color CYAN = …;
  44. public static final Color VIOLET = …;
  45. public static final Color BROWN = …;
  46.  
  47. // Predicate that tests whether the given row and column number refer to
  48. // a valid square inside the grid:
  49. // 0 <= row < rowCount AND 0 <= column < columnCount.
  50. // All other Grid methods abort the program with an error message,
  51. // if row or column numbers beyond the bounds of the grid are used.
  52.  
  53. public static boolean insideBounds (int row, int column);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement