title: How to sleep/wait Java Swing Timer
body: <p>In my platforming game, I have a swing timer that ticks the following method every 17 milliseconds. It is here that I run the various events that I need to run. My plan was to sleep the timer for 1 second whenever the player died.</p>
  
  <p>My problem is that I don't really have a firm understanding of how to sleep a swing timer. Every example that I look at involves using a Thread which is not what I am doing. When I do the following I get a IllegalMonitorStateException error.</p>
  
  <pre><code>public void actionPerformed(ActionEvent e) 
  {
      if (!louis.isDead)
      {
          if (louis.right)
          {
              louis.moveR();
          }
          if (louis.left)
          {
              louis.moveL();
          }
          if (!louis.left &amp;&amp; !louis.right) 
              louis.friction();
  
          louis.gravity();
  
          louis.checkCol(charMap, mapX, mapY);
  
          mapX -= louis.moveX();
          mapY -= louis.moveY();
  
          louis.checkDeath(charMap, mapX, mapY);
      }
      else
      {
          try {
              time.wait(1000);
          } catch (InterruptedException e1) {e1.printStackTrace();}
          mapX = initMapX;
          mapY = initMapY;
          louis = new Player(spawnX, spawnY);
      }
      repaint();
  }
  </code></pre>
  
  <p>Thanks in advance</p>