Browse Source

Change update for celltype bomb

feature_Minesweeper_Playfield
kfkama 3 years ago
parent
commit
b51cfb6732
  1. 2
      src/main/java/Minesweeper/Cell.java
  2. 1
      src/main/java/Minesweeper/Playfield.java

2
src/main/java/Minesweeper/Cell.java

@ -43,6 +43,8 @@ public class Cell extends JButton {
public void update() { public void update() {
if (type == CellType.Number) { if (type == CellType.Number) {
setText(String.valueOf(value)); setText(String.valueOf(value));
} else {
setBackground(Color.RED);
} }
} }

1
src/main/java/Minesweeper/Playfield.java

@ -38,6 +38,7 @@ public class Playfield {
for (int k = 0; k < bPlacement.length; k++) { for (int k = 0; k < bPlacement.length; k++) {
if (bPlacement[k] == i * Size + j) { if (bPlacement[k] == i * Size + j) {
cells[i][j].type = CellType.Bomb; cells[i][j].type = CellType.Bomb;
cells[i][j].update();
break; break;
} }
} }

Loading…
Cancel
Save