Grid.java
import java.awt.*;
class Grid { private Square[][] grid = new Square[100][100]; private int rows; private int cols;
public Grid(int r, int c) { rows = r; cols = c; int hsize = 500/c; int vsize = 500/r; int size; if (hsize < vsize) size = hsize; else size = vsize; for (int i = 0; i < rows; i++ ) for (int j = 0; j < cols; j++ ) { Square s = new Square(jsize, isize, size); grid[i][j] = s; s.makeVisible(); } }
public void color(int row, int col, String newColor ) { Square s = grid[row][col]; s.changeColor(newColor); }
public int firstRow() { return 0; }
public int lastRow() { return rows - 1; }
public int firstColumn() { return 0; }
public int lastColumn() { return cols-1; } }