title: How to create a modal JDialog on top of another modal JDialog
body: <p>I have a modal settings dialog which is a JDialog. In this settings window I placed some components including a button to yet another modal settings dialog which is also a JDialog. I made them JDialogs because that is the only way I know of to make a modal dialog.</p>
  
  <p>The problem is this: when I create the main settings dialog I have to construct the JDialog either without a parent Frame or with a parent Frame. Since my main window is a JFrame, I can just pass that to the main settings dialog constructor. But when I want to create the second modal settings dialog which should have the main settings dialog as a parent, I can't find a way to get the (J)Frame of the JDialog. I do want to pass that main settings dialog as a parent so that the second settings dialog centers on it when it is shown. Let's assume the second settings dialog has no constructor for passing a location, just the constructors of the JDialog.</p>
  
  <p>Is there a way to get the (J)Frame of a JDialog?
  Is there a design flaw in my setup and should I have used something else for these settings dialogs? (And if so, how should I make these alternative settings dialogs modal?)</p>
  
  <p>Thank you for your help,
  Erik</p>
  
  <p>UPDATE:
  Thank you all for your answers. They led me to understand that apparently it's not absolutely necessary to have an owner for a JDialog. I thought this was needed for the dialog to be able to disable the owner until the dialog is closed, but apparently the modality is independent of the owner. I also noticed that even with an owner the dialog still doesn't center on the owner, so now my code is like:</p>
  
  <pre><code>public class CustomDialog extends JDialog {
      public CustomDialog(String title) {
          setModal(true);
          setResizable(false);
          setTitle(title);
  
          buildGUI();
      }
  
      public Result showDialog(Window parent) {
          setLocationRelativeTo(parent);
          setVisible(true);
          return getResult();
      }
  }
  </code></pre>
  
  <p>This also allows for modal dialogs in modal dialogs.</p>
  
  <p>Thanks for all your help!</p>