Browse Source

Show proximity values on cells

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

8
src/main/java/Minesweeper/Cell.java

@ -13,4 +13,12 @@ public class Cell extends JButton {
public Cell(CellType _type) {
type = _type;
}
public void update() {
if(type == CellType.Number) {
setText(String.valueOf(value));
} else {
}
}
}

2
src/main/java/Minesweeper/MinesweeperGame.java

@ -18,7 +18,7 @@ public class MinesweeperGame extends JPanel {
public static void main(String[] args) {
JFrame f = new JFrame();
MinesweeperGame ttt = new MinesweeperGame(3, 0);
MinesweeperGame ttt = new MinesweeperGame(8, 10);
f.add(ttt);
f.setSize(WIDTH, HEIGTH);

2
src/main/java/Minesweeper/Playfield.java

@ -99,6 +99,8 @@ public class Playfield {
cells[row][column].value++;
}
}
cells[row][column].update();
}
}
Loading…
Cancel
Save