title: Unresponsive KeyListener for JFrame
body: <p>I'm trying to implement a <code>KeyListener</code> for my <code>JFrame</code>. On the constructor, I'm using this code:</p>
  
  <pre><code>System.out.println("test");
  addKeyListener(new KeyListener() {
      public void keyPressed(KeyEvent e) { System.out.println( "tester"); }
  
      public void keyReleased(KeyEvent e) { System.out.println("2test2"); }
  
      public void keyTyped(KeyEvent e) { System.out.println("3test3"); }
  });
  </code></pre>
  
  <p>When I run it, the <code>test</code> message comes up in my console. However, when I press a key, I don't get any of the other messages, as if the <code>KeyListener</code> was not even there.</p>
  
  <p>I was thinking that it could be because the focus is not on the <code>JFrame</code><br>
  and so they <code>KeyListener</code> doesn't receive any events.  But, I'm pretty sure it is.</p>
  
  <p>Is there something that I am missing?</p>