diff --git a/src/main/java/Minesweeper/Cell.java b/src/main/java/Minesweeper/Cell.java index 7b5e0de..93f8799 100644 --- a/src/main/java/Minesweeper/Cell.java +++ b/src/main/java/Minesweeper/Cell.java @@ -37,6 +37,8 @@ public class Cell extends JButton { protected void OnMouseClick() { if (type != CellType.Bomb) { flood(); + } else { + playfield.reset(); } } diff --git a/src/main/java/Minesweeper/Playfield.java b/src/main/java/Minesweeper/Playfield.java index eed046b..38f61cc 100644 --- a/src/main/java/Minesweeper/Playfield.java +++ b/src/main/java/Minesweeper/Playfield.java @@ -2,6 +2,8 @@ package Minesweeper; import java.awt.Point; +import javax.swing.JOptionPane; + public class Playfield { private static final int CELLSIZE = 50; @@ -61,6 +63,7 @@ public class Playfield { } public void reset() { + JOptionPane.showMessageDialog(MsG,"KABOOM! Try again!"); for (int i = 0; i < Size; i++) { for (int j = 0; j < Size; j++) { MsG.remove(cells[i][j]);