title: JFrame catch dispose event
body: <p>I have a Java project.<br>
  I have a JFrame with a handler attached to it like so<br></p>
  
  <pre><code>frame.addWindowListener(new WindowAdapter() {
  
              public void windowClosing(WindowEvent evt) {
                  this.setEnabled(true);
  
              }
          });
  </code></pre>
  
  <p>But, on that frame I also have a close button (to make it more user friendly) and that "close" button calls the frame dispose method. Now, when I close the frame by clicking the little x button on the top right corner, the WindowListener is called. But the event doesn't fire when I invoke the dispose method.
  <br>
  should I Invoke some other method to close, so the WindowListener fires, or maybe implement another listener?
  <br></p>