Method to create sixth board from scratch. @param is_loaded True if the board is loaded from a file.
(boolean is_loaded)
| 458 | * @param is_loaded True if the board is loaded from a file. |
| 459 | */ |
| 460 | public void Board6(boolean is_loaded){ |
| 461 | reset_screen(); |
| 462 | grid = new GridLayout(7, 9, 2, 2); |
| 463 | setLayout(grid); |
| 464 | boardType = 6; |
| 465 | score = -1; |
| 466 | moves.clear(); |
| 467 | |
| 468 | //Fill the board if it was not loaded from a file. |
| 469 | if (!is_loaded){ |
| 470 | board = new JButton[5][5]; |
| 471 | for (int i = 0; i < 5; ++i){ |
| 472 | for (int j = 0; j < 5; ++j){ |
| 473 | board[i][j] = new JButton(); |
| 474 | if ( (i==0 && (j==1||j==2||j==3||j==4)) || |
| 475 | (i==1 && (j==2||j==3||j==4)) || |
| 476 | (i==2 && (j==3||j==4)) || |
| 477 | (i==3 && j==4)) |
| 478 | board[i][j].setBackground(Color.WHITE); |
| 479 | else board[i][j].setBackground(Color.BLACK); |
| 480 | } |
| 481 | } |
| 482 | board[0][0].setBackground(Color.GRAY); |
| 483 | } |
| 484 | |
| 485 | //Adding cells to frame. |
| 486 | addBoardTriangle(); |
| 487 | |
| 488 | //Adding game buttons to frame. |
| 489 | add(reset); |
| 490 | add(load); |
| 491 | add(save); |
| 492 | add(undo); |
| 493 | add(pegNumber); |
| 494 | add(emptyCells); |
| 495 | add(pegsOut); |
| 496 | add (auto); |
| 497 | add(autoAll); |
| 498 | |
| 499 | //Adding radio buttons to frame. |
| 500 | add(type1);add(type2);add(type3);add(type4);add(type5);add(type6); |
| 501 | addingListenersType(); |
| 502 | } |
| 503 | |
| 504 | /** |
| 505 | * Method to add cell buttons to the frame for first 5 types. |
nothing calls this directly
no test coverage detected