title: How to extract the button which was pressed from JDialog?
body: <p>I've generated a JDialog with the use of JOption C'tor in the following lines:</p>
  
  <pre><code> Object[] options =
              {
          "Yes", "No (Exit to main menu)"
          };
          JOptionPane messagePane = new JOptionPane(i_StringMessage+"\nDo you want to begin another Net Game?", JOptionPane.INFORMATION_MESSAGE, JOptionPane.YES_NO_OPTION, null, options);
          messagePane.setLocation(500, 1000);
          JDialog dialog = messagePane.createDialog(m_GameApplet.GetJpanelStartNetGame(), "Game over");
          m_GameApplet.GetJpanelStartNetGame().SetPopUpWindowReference(dialog);
          m_GameApplet.GetJpanelStartNetGame().GetPopUpWindowReference().setVisible(true);
  </code></pre>
  
  <p>I set the JDialog to be visible, but I wonder how can I now receive and parse the button that the user has clicked on, in a similar way to using the static JOption functions like that:</p>
  
  <pre><code>int userChoice = JOptionPane.showOptionDialog(this, i_StringMessage+"\nDo you want to begin another Net Game?",
                  "Game over", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
  </code></pre>
  
  <p>How can I close a JDialog, and what does dispose function excately do?<br>
  Thanks   </p>