title: Closing a java program properly when JDialog is the main window
body: <p>I have a JDialog as the main window in my application (originally it was a JFrame but it showed in the taskbar which I didn't want).  </p>
  
  <p>Currently I am doing:</p>
  
  <pre><code>setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  </code></pre>
  
  <p>and when I click an exit button:</p>
  
  <pre><code>frame.dispose();
  </code></pre>
  
  <p>But the process still seems to hang around in the background</p>
  
  <p>JFrame had <code>JFrame.EXIT_ON_CLOSE</code> which seemed to do what I wanted.</p>
  
  <p>How can I close my application properly?</p>