
/* 
   An object belonging to this class is a window full of colored
   squares.  The setColor() method can be used to set the color
   of a symmetrical group of squares (consisting of a square and
   its horizontal and vertical reflections).  As long as this is
   the only method used to set square colors, the window will
   always display a symmetrical pattern of squares.
*/


public class SymmetricMosaicFrame extends MosaicFrame {

   int rows, columns;  // number of rows and columns of
                       // colored squares in this window.
   
   public SymmetricMosaicFrame(int rows, int columns) {
         // Call the superclass constructor to open
         // a window with the specified numbers of rows
         // and columns.  Also, remember the number of 
         // rows and columns in instance variables, since
         // they are needed in the setColor() method below.
      super(rows,columns);
      this.rows = rows;
      this.columns = columns;
   }
   
   public void setColor(int R, int C, int r, int g, int b) {
        // Set the color of the square in row R and column C,
        // as well as the horizontal and vertical reflections 
        // of that sqaure.  The color of the squares is the
        // color with red, green, and blue components given
        // by the parameters r, g, and b.
      super.setColor(R, C, r, g, b);
      super.setColor(R, columns - 1- C, r, g, b);
      super.setColor(rows - R - 1, C, r, g, b);
      super.setColor(rows - R - 1, columns - 1 - C, r, g, b);
   }

}




