title: KeyListener not adding
body: <p>I am pretty sure I am missing something pretty simple here, but I just can't find it!</p>
  
  <p>Here is the declaration for my <code>GamePanel</code> class:</p>
  
  <pre><code>private class GamePanel extends JPanel implements KeyListener {
  </code></pre>
  
  <p>In its constructor is:</p>
  
  <pre><code>addKeyListener(this);
  </code></pre>
  
  <p>Also in the constructor:</p>
  
  <pre><code>        new Thread(new Runnable() {
  
              @Override
              public void run() {
                  while (true) {
                      index ++;
                      index = index &gt;= 15 ? 0 : index;
                      if (aPress) {
                          playerX --;
                      }
                      if (dPress) {
                          playerX ++;
                      }
                      repaint();
                      try {
                          Thread.sleep(25);
                      } catch (InterruptedException e) {}
                  }
              }
  
          }).start();
  </code></pre>
  
  <p>In the class:</p>
  
  <pre><code>    @Override
      public void keyPressed(KeyEvent e) {
          System.out.println("Key pressed!");
          if (e.getKeyCode() == KeyEvent.VK_A) {
              aPress = true;
          }
          if (e.getKeyCode() == KeyEvent.VK_D) {
              dPress = true;
          }
      }
      @Override
      public void keyReleased(KeyEvent e) {
          if (e.getKeyCode() == KeyEvent.VK_A) {
              aPress = false;
          }
          if (e.getKeyCode() == KeyEvent.VK_D) {
              dPress = false;
          }
      }
  </code></pre>
  
  <p>And finally:</p>
  
  <pre><code>JFrame f = new JFrame();
  //set up f
  f.add(new GamePanel());
  f.setVisible(true);
  </code></pre>
  
  <p>I even added a <code>System.out.println</code> in my <code>keyPressed</code> method and it won't print! What am I missing?</p>