title: close window event in java
body: <p>I added an window state listener as follow:</p>
  
  <pre><code>this.addWindowStateListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
              ExitAction.getInstance().actionPerformed(null);
          }
  
      });
  </code></pre>
  
  <p>But when I'm using the X close button the event is not called.
  I think it's something to do with netbean jdesktop framework. But I can't find what could be the problem. 
  Thanks for your help. </p>