title: Resetting countdown timer not working + JDialog/JOptionPane in Java Swing game
body: <p>I'm not that good with Java Swing and I'm trying to use a timer start the game with a delay in 3 seconds</p>
  
  <p>But at the same time I want to show a dialog (also the game has to wait 3 seconds so the focus needs to be on the dialog)</p>
  
  <p>So my dialog is as follow: <a href="https://stackoverflow.com/a/12451673/230513">got this sample code</a></p>
  
  <p>So in my gameplay panel I do this:</p>
  
  <pre><code>public class GamePlayPanel extends JPanel implements ActionListener {
      // attributes
      private JOptionCountDownTimer countDownDialog;
      public GamePlayPanel(MainWindow mainWindow) {
          // initialization attributes
          initLayoutPanel();
          this.timer = new Timer(DELAY, this);
          // Added a delay of 3 seconds so you can prepare to for the game
          this.timer.setInitialDelay(3000);
          resetTime();
      }        
  
  
      public void startGame() {
          this.gamePanel.requestFocus();
          this.countDownDialog.startCountDown();
          startTimer(); // this is my game timer to record the game time
      }
  
  
      public void restartGame() {
          this.countDownDialog.resetCountDown();
          startTimer();       
          this.gamePanel.requestFocus();
      }
  }
  </code></pre>
  
  <p>It works fine but if I restart the game the count down timer starts at 0 -> 2 seconds.</p>
  
  <p>Also any better ideas on my class <code>JOptionCountDownTimer</code>? I tried to make it extend a <code>JDialog</code> class but I couldn't get it to work.</p>