title: How to make a resizable JDialog?
body: <p>I'm using JOptionPane.showOptionDialog to show a JDialog. I would like to know how:</p>
  
  <ol>
  <li>set the dimension of the dialog (for now I'm using setPreferredSize() method on the given panel but I know that such method shouldn't be used).</li>
  <li>make the showed dialog resizable.</li>
  </ol>
  
  <p>My code looks like:</p>
  
  <pre><code>JPanel panel; //my JPanel built with dialog contents
  int ret = JOptionPane.showOptionDialog(myFrame,
                      panel,
                          "titel",
                      JOptionPane.YES_NO_OPTION,
                      JOptionPane.PLAIN_MESSAGE,
                      null,
                      options,
                      options[1]);
  </code></pre>
  
  <p>I know that I could obtain the desired result building a JDialog this way:</p>
  
  <pre><code>JDialog dialog = new JDialog(panel);
  dialog.setResizable(true);
  dialog.setSize(800,600);
  dialog.setVisible(true);
  </code></pre>
  
  <p>The problem with the last solution is that I can't get the return value.</p>
  
  <p>EDIT:
  in response to @camickr observations:</p>
  
  <blockquote>
    <p>Why do you need to set the preferred size? If you build the panel
    properly is should be displayed at its preferred size.</p>
  </blockquote>
  
  <p>I'm not sure of having fully understood Swing on this point. The problem is, for example, that I'm displaying through a JDialog a ChartPanel built with JFreeChart. Now, I suppose that panel has it's own preferred size, but I want to see it bigger. How can I do that without explicitly use setPreferredSize()?</p>
  
  <blockquote>
    <p>Read the JOptionPane API. Search for "Direct Use". It shows you how to
    directly access the dialog used by the option pane and you can</p>
  </blockquote>
  
  <p>I read it but I can't find the right method to understand which button (Ok or Cancel) has been pressed on the JDialog.</p>