title: Why won't this listener detect window close events?
body: <p>I'm trying to listen for events on a single <code>Frame</code> via <code>WindowStateListener</code>.</p>
  
  <pre><code>import java.awt.Frame;
  import java.awt.Label;
  
  import java.awt.event.WindowStateListener;
  import java.awt.event.WindowEvent;
  
  public class UserInterface implements WindowStateListener
  {
      public static void main(final String[] arguments)
      {
          UserInterface userInterface = new UserInterface();
      }
  
      public UserInterface()
      {
          Frame frame = new Frame("Graphics Example");
          frame.addWindowStateListener(this);
          frame.add(new Label("Hello, world!");
          frame.pack();
          frame.setVisible(true);
      }
  
      public void windowStateChanged(WindowEvent event)
      {
          System.out.println(event.paramString();
      }
  }
  </code></pre>
  
  <p>It's working fine for minimization events, but not close events.  <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/awt/event/WindowEvent.html" rel="noreferrer"><code>WINDOW_CLOSING</code> is definitely a valid <code>WindowEvent</code> value</a>, and <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/awt/Frame.html" rel="noreferrer">it's definitely something that <code>Frame</code> can throw</a>.  So why isn't it being passed to <code>windowStateChanged()</code>?</p>