import java.io.*; import java.net.*; 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 = 6; // distance of the grid, in cells, int dY = 15; // 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; static BufferedReader input; static boolean iseof = false; // Initialize an empty grid in the given graphics environment 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