import java.awt.*; import java.awt.event.*; import PieceButton; import OthelloRules; import java.awt.Color; public class GUIBoard extends Panel { /** create fields for each button of the board */ protected PieceButton[][] buttarray; /**create a constructor */ protected GUIBoard(int x, int y, OthelloRules rules) { this.setLayout(new GridLayout(x,y)); this.buttarray = new PieceButton[x+1][y+1]; for(int i = 1; i<=x; i++) { for(int j = 1; j<=y; j++) { this.buttarray[j][i] = new PieceButton(rules,j,i); this.add(this.buttarray[j][i]); } // for } // for // here we must ask rules where the initial pieces are and what // their color is and then paint those buttons this.buttarray[5][4].flip(Color.black); this.buttarray[4][5].flip(Color.black); this.buttarray[4][4].flip(Color.white); this.buttarray[5][5].flip(Color.white); }//main() }//class