Method to create first board from scratch. @param is_loaded True if the board is loaded from a file.
(boolean is_loaded)
| 220 | * @param is_loaded True if the board is loaded from a file. |
| 221 | */ |
| 222 | public void Board1(boolean is_loaded){ |
| 223 | reset_screen(); |
| 224 | grid = new GridLayout(10, 7, 2, 2); |
| 225 | setLayout(grid); |
| 226 | boardType = 1; |
| 227 | score = -1; |
| 228 | moves.clear(); |
| 229 | |
| 230 | //Fill the board if it was not loaded from a file. |
| 231 | if(!is_loaded){ |
| 232 | board = new JButton[7][7]; |
| 233 | for (int i = 0; i < 7; ++i){ |
| 234 | for (int j = 0; j < 7; ++j){ |
| 235 | board[i][j] = new JButton(); |
| 236 | if ( ((i==0 || i==6) && (j==0 || j==1 || j==5 || j==6)) || |
| 237 | ((i==1 || i==5) && (j==0 || j==6)) ) |
| 238 | board[i][j].setBackground(Color.WHITE); |
| 239 | else board[i][j].setBackground(Color.BLACK); |
| 240 | } |
| 241 | } |
| 242 | board[2][3].setBackground(Color.GRAY); |
| 243 | } |
| 244 | |
| 245 | //Adding cells to frame. |
| 246 | addBoard(); |
| 247 | |
| 248 | //Adding game buttons to frame. |
| 249 | add(reset); add(load); add(save); add(undo); add(pegNumber); add(emptyCells); add(pegsOut); |
| 250 | add(new JLabel()); add(new JLabel()); |
| 251 | add (auto); |
| 252 | add(new JLabel()); |
| 253 | add(autoAll); |
| 254 | add(new JLabel()); add(new JLabel()); |
| 255 | |
| 256 | //Adding radio buttons to frame. |
| 257 | add(type1);add(type2);add(type3);add(type4);add(type5);add(type6); |
| 258 | addingListenersType(); |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Method to create second board from scratch. |
nothing calls this directly
no test coverage detected