title: Button for closing a JDialog
body: <p>I want to add a button (JButton) at the bottom of a JDialog which should close the JDialog when pressed. The problem is I don't know what to write in the ActionListener of that button. I don't want the button to exit the program, just close the dialog.</p>
  
  <p>The JDialog is created by explicitly calling one of JDialog's constructors, not by calling one of the methods from JOptionPane.</p>
  
  <p>I was extremely surprised that I was unable to find an answer to this using Google. I expected that a problem that is so often encoutered would be widely covered on a lot of programming sites. Pretty weird that it is not.</p>