Java Code Examples for javax.swing.plaf.FileChooserUI#getDialogTitle()

The following examples show how to use javax.swing.plaf.FileChooserUI#getDialogTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JFileChooser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 2
Source File: JFileChooser.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 3
Source File: JFileChooser.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 4
Source File: JFileChooser.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 5
Source File: JFileChooser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 6
Source File: JFileChooser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 7
Source File: JFileChooser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 8
Source File: JFileChooser.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 9
Source File: JFileChooser.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 10
Source File: JFileChooser.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 11
Source File: JFileChooser.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 12
Source File: JFileChooser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 13
Source File: JFileChooser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 14
Source File: JFileChooser.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 15
Source File: JFileChooser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 16
Source File: JFileChooser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
Example 17
Source File: JFileChooser.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * 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.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}