title: How do I make non-modal dialog whose setVisible blocks?
body: <p>In a Swing (J)Dialog, <a href="http://download.oracle.com/javase/6/docs/api/java/awt/Dialog.html#setModal%28boolean%29" rel="nofollow">setModal</a> sets the modality - that is, whether the dialog should block input to other windows or not. Then, <a href="http://download.oracle.com/javase/6/docs/api/java/awt/Dialog.html#setVisible%28boolean%29" rel="nofollow">setVisible</a> docs say <em>for modal dialogs</em>:</p>
  
  <blockquote>
    <p>If the dialog is not already visible, this call will not return until the dialog is hidden by calling setVisible(false) or dispose.</p>
  </blockquote>
  
  <p>Indeed, <code>setVisible</code> <em>does</em> return right away if the dialog is not modal. Sample code:</p>
  
  <pre><code>JDialog jd = new JDialog();
  jd.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  
  /**
   * If set to false, setVisible returns right away.
   * If set to true, setVisible blocks until dialog is disposed.
   */
  jd.setModal(false);
  
  System.out.println("setting visible");
  jd.setVisible(true);
  System.out.println("set visible returned");
  </code></pre>
  
  <p>I want to make a dialog that <em>doesn't</em> block input to other windows, but still <em>does</em> block the caller. What is a good way to do this, now that <code>setVisible</code> doesn't block when the dialog is not modal?</p>
  
  <p><strong>Is there some rationale <em>why</em> <code>setVisible</code>'s behavior depends on the modality?</strong></p>