title: Java: on mac keyboard input only firing once
body: <p>The question I have is regarding how to overcome a keyboard issue. When I press certain keys like 'up' and 'down', the method keyPressed keeps on activating, but when I press keys like 'w' or 's' the method only activates once until I release and press it again. I would like to know how to simulate repeated key presses.</p>
  
  <p>here is the class for input:</p>
  
  <pre><code>public class Input extends KeyAdapter{
  
      private GameObject p1;
      private GameObject p2;
  
      public Input(Handler handler){
          p1 = handler.object.get(0);
          p2 = handler.object.get(1);
      }
  
      public void keyPressed(KeyEvent e){
  
          System.out.println("thismethodactivated");
  
          int key = e.getKeyCode();
          if(key == KeyEvent.VK_W) p1.setVelY(-5);
          if(key == KeyEvent.VK_S) p1.setVelY(5);
          if(key == KeyEvent.VK_D) p1.activate(1);
  
          if(key == KeyEvent.VK_UP) p2.setVelY(-5);
          if(key == KeyEvent.VK_DOWN) p2.setVelY(5);
          if(key == KeyEvent.VK_LEFT) p2.activate(1);
      }
  
      public void keyReleased(KeyEvent e){
          int key = e.getKeyCode();
          if(key == KeyEvent.VK_W) p1.setVelY(0);
          if(key == KeyEvent.VK_S) p1.setVelY(0);
  
          if(key == KeyEvent.VK_UP) p2.setVelY(0);
          if(key == KeyEvent.VK_DOWN) p2.setVelY(0);
      }
  }
  </code></pre>