title: JFrame On Close Operation
body: <p>I was wondering if there is a way, by clicking on the "X", to let the program perform some code before closing the JFrame. The <code>setDefaultCloseOperation()</code> method takes only an integer.</p>
  
  <pre><code>setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  </code></pre>