title: why the key pressed does not trigger any event?
body: <p>Following is a program that displays a black screen with a messgage <em>ALARM !</em> :</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import java.awt.event.*;
  
  
  public class displayFullScreen extends Window {
      private JLabel alarmMessage = new JLabel("Alarm !");
  
      public displayFullScreen() {
          super(new JFrame());
          setLayout(new FlowLayout(FlowLayout.CENTER));
          alarmMessage.setFont(new Font("Cambria",Font.BOLD,100));
          alarmMessage.setForeground(Color.CYAN);
          add(alarmMessage);
          Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
          setBounds(0,0,screenSize.width,screenSize.height);
          setBackground(Color.black);
  
          addKeyListener(new KeyAdapter() {
             @Override
             public void keyPressed(KeyEvent ke) {
                  escapeHandler(ke);
             } 
          });
      }
  
      public void escapeHandler(KeyEvent ke) {
          if(ke.getKeyCode() == ke.VK_ESCAPE) {
              System.out.println("escaped !");
          } else {
              System.out.println("Not escaped !");
          }
      }
  
      public static void main(String args[]) {
          new displayFullScreen().setVisible(true);
      }
  }
  </code></pre>
  
  <p>I have set a key handler in this program . The handler catches the keys pressed when the focus is on window.
  When the escape key will be pressed <code>escaped !</code> should be displayed otherwise <code>!escaped</code>.
  But nothing gets displayed,when i press a key. What is the problem ? </p>