From 1a7908fa2a0b1e43882cdbb9f0eeee0530a5328e Mon Sep 17 00:00:00 2001 From: kfkama Date: Thu, 17 Feb 2022 20:09:28 +0100 Subject: [PATCH] Reset timer on game end --- src/main/java/Minesweeper/MinesweeperGame.java | 4 +++- src/main/java/Minesweeper/Playfield.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/Minesweeper/MinesweeperGame.java b/src/main/java/Minesweeper/MinesweeperGame.java index 1741988..cf07347 100644 --- a/src/main/java/Minesweeper/MinesweeperGame.java +++ b/src/main/java/Minesweeper/MinesweeperGame.java @@ -8,12 +8,14 @@ public class MinesweeperGame extends JPanel { private static final long serialVersionUID = 1L; public static final int WIDTH = 600, HEIGTH = 600; public Playfield playfield; + public TimerLable tl; public MinesweeperGame(int _playfieldSize, int _bombAmount) { this.setSize(WIDTH, HEIGTH); setLayout(null); playfield = new Playfield(this, _playfieldSize, _bombAmount); - TimerLable tl = new TimerLable(); + + tl = new TimerLable(); tl.setBounds((WIDTH / 2 - 5), HEIGTH / 2 - 240, 20, 20); add(tl); tl.start(); diff --git a/src/main/java/Minesweeper/Playfield.java b/src/main/java/Minesweeper/Playfield.java index 9e73cb8..425f4f2 100644 --- a/src/main/java/Minesweeper/Playfield.java +++ b/src/main/java/Minesweeper/Playfield.java @@ -69,6 +69,7 @@ public class Playfield { MsG.remove(cells[i][j]); } } + MsG.tl.reset(); generatePlayfield(); }