Search in sources :

Example 1 with FileChooserUI

use of javax.swing.plaf.FileChooserUI in project jdk8u_jdk by JetBrains.

the class JFileChooser method updateUI.

// *********************************
// ***** Pluggable L&F methods *****
// *********************************
/**
     * Resets the UI property to a value from the current look and feel.
     *
     * @see JComponent#updateUI
     */
public void updateUI() {
    if (isAcceptAllFileFilterUsed()) {
        removeChoosableFileFilter(getAcceptAllFileFilter());
    }
    FileChooserUI ui = ((FileChooserUI) UIManager.getUI(this));
    if (fileSystemView == null) {
        // We were probably deserialized
        setFileSystemView(FileSystemView.getFileSystemView());
    }
    setUI(ui);
    if (isAcceptAllFileFilterUsed()) {
        addChoosableFileFilter(getAcceptAllFileFilter());
    }
}
Also used : FileChooserUI(javax.swing.plaf.FileChooserUI)

Example 2 with FileChooserUI

use of javax.swing.plaf.FileChooserUI in project jdk8u_jdk by JetBrains.

the class JFileChooser method createDialog.

/**
     * 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;
}
Also used : Window(java.awt.Window) Frame(java.awt.Frame) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) Dialog(java.awt.Dialog) FileChooserUI(javax.swing.plaf.FileChooserUI)

Example 3 with FileChooserUI

use of javax.swing.plaf.FileChooserUI in project vcell by virtualcell.

the class LWFileChooser method createDialog.

@Override
protected JDialog createDialog(Component parent) throws HeadlessException {
    LWContainerHandle lwParent = LWNamespace.findLWOwner(parent);
    // copied from Java source
    FileChooserUI ui = getUI();
    String title = ui.getDialogTitle(this);
    putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, title);
    JDialog dialog = new ChooserDialog(lwParent, title);
    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;
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) FileChooserUI(javax.swing.plaf.FileChooserUI) JDialog(javax.swing.JDialog)

Example 4 with FileChooserUI

use of javax.swing.plaf.FileChooserUI in project evosuite by EvoSuite.

the class MockJFileChooser method updateUI.

// *********************************
// ***** Pluggable L&F methods *****
// *********************************
public void updateUI() {
    if (isAcceptAllFileFilterUsed()) {
        removeChoosableFileFilter(getAcceptAllFileFilter());
    }
    FileChooserUI ui = ((FileChooserUI) UIManager.getUI(this));
    if (fileSystemView == null) {
        // We were probably deserialized
        setFileSystemView(MockFileSystemView.getFileSystemView());
    }
    setUI(ui);
    if (isAcceptAllFileFilterUsed()) {
        addChoosableFileFilter(getAcceptAllFileFilter());
    }
}
Also used : FileChooserUI(javax.swing.plaf.FileChooserUI)

Example 5 with FileChooserUI

use of javax.swing.plaf.FileChooserUI in project evosuite by EvoSuite.

the class MockJFileChooser method createDialog.

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 = 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;
}
Also used : Window(java.awt.Window) Frame(java.awt.Frame) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JDialog(javax.swing.JDialog) Dialog(java.awt.Dialog) FileChooserUI(javax.swing.plaf.FileChooserUI) JDialog(javax.swing.JDialog)

Aggregations

FileChooserUI (javax.swing.plaf.FileChooserUI)5 BorderLayout (java.awt.BorderLayout)3 Container (java.awt.Container)3 Dialog (java.awt.Dialog)2 Frame (java.awt.Frame)2 Window (java.awt.Window)2 JDialog (javax.swing.JDialog)2