* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
* @since 1.4
*/
protected JDialog createDialog(Component parent) throws HeadlessException {
FileChooserUI ui = getUI();
String title = ui.getDialogTitle(this);
putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY,
title);
JDialog dialog;
Window window = JOptionPane.getWindowForComponent(parent);
if (window instanceof Frame) {
dialog = new JDialog((Frame)window, title, true);
} else {
dialog = new JDialog((Dialog)window, title, true);
}
dialog.setComponentOrientation(this.getComponentOrientation());
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(this, BorderLayout.CENTER);
if (JDialog.isDefaultLookAndFeelDecorated()) {
boolean supportsWindowDecorations =
UIManager.getLookAndFeel().getSupportsWindowDecorations();
if (supportsWindowDecorations) {
dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
}
}
dialog.getRootPane().setDefaultButton(ui.getDefaultButton(this));
dialog.pack();
dialog.setLocationRelativeTo(parent);
return dialog;
}