Here you can find the source of createJDialog(Component parentComponent)
public static JDialog createJDialog(Component parentComponent) throws HeadlessException
//package com.java2s; /*/*from ww w . j a v a 2 s . c om*/ * Copyright (C) 2011 Peransin Nicolas. * Use is subject to license terms. */ import java.awt.Component; import java.awt.Dialog; import java.awt.Frame; import java.awt.HeadlessException; import java.awt.Window; import javax.swing.JDialog; import javax.swing.SwingUtilities; public class Main { public static JDialog createJDialog(Component parentComponent) throws HeadlessException { return createJDialog(parentComponent, null, true); } public static JDialog createJDialog(Component parentComponent, String title) throws HeadlessException { return createJDialog(parentComponent, title, true); } public static JDialog createJDialog(Component parentComponent, String title, boolean modal) throws HeadlessException { Window window = SwingUtilities.getWindowAncestor(parentComponent); if (window instanceof Frame) { return new JDialog((Frame) window, title, modal); } else { return new JDialog((Dialog) window, title, modal); } } }