2 Commits

Author SHA1 Message Date
kfkama 520c5dc3a0 Bugfix timer reset 3 years ago
kfkama d6f1baffe9 Timer stops while game end dialog is open 3 years ago
  1. 1
      src/main/java/Minesweeper/Playfield.java
  2. 11
      src/main/java/Minesweeper/TimerLable.java

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

@ -141,6 +141,7 @@ public class Playfield {
}
}
}
MsG.tl.stop();
MsG.repaint();
}

11
src/main/java/Minesweeper/TimerLable.java

@ -24,14 +24,22 @@ public class TimerLable extends JLabel {
public void reset() {
task.reset = true;
counter = 0;
setText(String.valueOf(counter));
repaint();
task.stop = false;
}
public void stop() {
task.stop = true;
}
}
class Helper extends TimerTask
{
public boolean reset;
public boolean stop;
public static int i = 0;
private TimerLable timerLable;
@ -40,6 +48,9 @@ class Helper extends TimerTask
}
public void run()
{
if(stop) {
return;
}
if(reset) {
reset = false;
timerLable.counter = 0;

Loading…
Cancel
Save