import java.awt.*; public class Grid { Graphics g; // graphics environment for the grid int size, cellSize; // number per row, and size of cells final char OFF = ' ', ON = '.', EX = 'X', OH = 'O'; // state of a cell char[][] cells; // all cell values for the grid int dX, dY = 6; // distance of the grid, in cells, // from upperleft corner of the frame boolean gridError; public int row, col; // row and column of last mouse click in the grid // (-1, -1) means click was outside the grid int i, j; Color current_color; // Open a graphics window and initialize a grid public Grid (Graphics gg, int s, int cs, int horizontal) { g = gg; size = s; cellSize = cs; dX = horizontal; cells = new char[s][s]; for (int i=0; i