dialog.setModal(true);
JDialog(Dialog owner, String title, boolean modal)
Creates a modal or non-modal dialog with the specified title and the
specified owner frame.
JDialog(Frame owner, boolean modal)
Creates a modal or non-modal dialog without a title and with the specified owner Frame.