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());
}
}
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;
}
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;
}
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());
}
}
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;
}
Aggregations