Method to create fifth board from scratch. @param is_loaded True if the board is loaded from a file.
(boolean is_loaded)
| 403 | * @param is_loaded True if the board is loaded from a file. |
| 404 | */ |
| 405 | public void Board5(boolean is_loaded){ |
| 406 | reset_screen(); |
| 407 | grid = new GridLayout(11, 9, 2, 2); |
| 408 | setLayout(grid); |
| 409 | boardType = 5; |
| 410 | score = -1; |
| 411 | moves.clear(); |
| 412 | |
| 413 | //Fill the board if it was not loaded from a file. |
| 414 | if (!is_loaded){ |
| 415 | board = new JButton[9][9]; |
| 416 | for (int i = 0; i < 9; ++i){ |
| 417 | for (int j = 0; j < 9; ++j){ |
| 418 | board[i][j] = new JButton(); |
| 419 | if (i==0 || i==8){ |
| 420 | if (j==4) board[i][j].setBackground(Color.BLACK); |
| 421 | else board[i][j].setBackground(Color.WHITE); |
| 422 | } |
| 423 | else if (i==1 || i==7){ |
| 424 | if (j==3 || j==4 || j==5) board[i][j].setBackground(Color.BLACK); |
| 425 | else board[i][j].setBackground(Color.WHITE); |
| 426 | } |
| 427 | else if (i==2 || i==6){ |
| 428 | if (j==0 || j==1 || j==7 || j==8) board[i][j].setBackground(Color.WHITE); |
| 429 | else board[i][j].setBackground(Color.BLACK); |
| 430 | } |
| 431 | else if (i==3 || i==5){ |
| 432 | if (j==0 || j==8) board[i][j].setBackground(Color.WHITE); |
| 433 | else board[i][j].setBackground(Color.BLACK); |
| 434 | } |
| 435 | else board[i][j].setBackground(Color.BLACK); |
| 436 | } |
| 437 | } |
| 438 | board[4][4].setBackground(Color.GRAY); |
| 439 | } |
| 440 | |
| 441 | //Adding cells to frame. |
| 442 | addBoard(); |
| 443 | |
| 444 | //Adding game buttons to frame. |
| 445 | add(reset); |
| 446 | add(load); add(save); |
| 447 | add(undo); |
| 448 | add(pegNumber); add(emptyCells); add(pegsOut); |
| 449 | add (auto); add(autoAll); |
| 450 | |
| 451 | //Adding radio buttons to frame. |
| 452 | add(type1);add(type2);add(type3);add(type4);add(type5);add(type6); |
| 453 | addingListenersType(); |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * Method to create sixth board from scratch. |
nothing calls this directly
no test coverage detected