BasicFileChooserUI (Java Platform SE 8 ) (original) (raw)
- javax.swing.plaf.ComponentUI
- javax.swing.plaf.FileChooserUI
- javax.swing.plaf.basic.BasicFileChooserUI
- javax.swing.plaf.FileChooserUI
Direct Known Subclasses:
MetalFileChooserUI
public class BasicFileChooserUI
extends FileChooserUI
Basic L&F implementation of a FileChooser.
Nested Class Summary
Nested Classes
Modifier and Type Class Description protected class BasicFileChooserUI.AcceptAllFileFilter protected class BasicFileChooserUI.ApproveSelectionAction Responds to an Open or Save request protected class BasicFileChooserUI.BasicFileView protected class BasicFileChooserUI.CancelSelectionAction Responds to a cancel request. protected class BasicFileChooserUI.ChangeToParentDirectoryAction protected class BasicFileChooserUI.DoubleClickListener protected class BasicFileChooserUI.GoHomeAction Acts on the "home" key event or equivalent event. protected class BasicFileChooserUI.NewFolderAction Creates a new folder. protected class BasicFileChooserUI.SelectionListener protected class BasicFileChooserUI.UpdateAction Rescans the files in the current directory Field Summary
Fields
Modifier and Type Field Description protected int cancelButtonMnemonic protected String cancelButtonText protected String cancelButtonToolTipText protected Icon computerIcon protected Icon detailsViewIcon protected Icon directoryIcon protected int directoryOpenButtonMnemonic The mnemonic keycode used for the approve button when a directory is selected and the current selection mode is FILES_ONLY. protected String directoryOpenButtonText The label text displayed on the approve button when a directory is selected and the current selection mode is FILES_ONLY. protected String directoryOpenButtonToolTipText The tooltip text displayed on the approve button when a directory is selected and the current selection mode is FILES_ONLY. protected Icon fileIcon protected Icon floppyDriveIcon protected Icon hardDriveIcon protected int helpButtonMnemonic protected String helpButtonText protected String helpButtonToolTipText protected Icon homeFolderIcon protected Icon listViewIcon protected Icon newFolderIcon protected int openButtonMnemonic protected String openButtonText protected String openButtonToolTipText protected int saveButtonMnemonic protected String saveButtonText protected String saveButtonToolTipText protected int updateButtonMnemonic protected String updateButtonText protected String updateButtonToolTipText protected Icon upFolderIcon protected Icon viewMenuIcon Constructor Summary
Constructors
Constructor Description BasicFileChooserUI(JFileChooser b) Method Summary
All Methods Static Methods Instance Methods Concrete Methods
* ### Methods inherited from class javax.swing.plaf.[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf") `[contains](../../../../javax/swing/plaf/ComponentUI.html#contains-javax.swing.JComponent-int-int-), [getAccessibleChild](../../../../javax/swing/plaf/ComponentUI.html#getAccessibleChild-javax.swing.JComponent-int-), [getAccessibleChildrenCount](../../../../javax/swing/plaf/ComponentUI.html#getAccessibleChildrenCount-javax.swing.JComponent-), [getBaseline](../../../../javax/swing/plaf/ComponentUI.html#getBaseline-javax.swing.JComponent-int-int-), [getBaselineResizeBehavior](../../../../javax/swing/plaf/ComponentUI.html#getBaselineResizeBehavior-javax.swing.JComponent-), [getMaximumSize](../../../../javax/swing/plaf/ComponentUI.html#getMaximumSize-javax.swing.JComponent-), [getMinimumSize](../../../../javax/swing/plaf/ComponentUI.html#getMinimumSize-javax.swing.JComponent-), [getPreferredSize](../../../../javax/swing/plaf/ComponentUI.html#getPreferredSize-javax.swing.JComponent-), [paint](../../../../javax/swing/plaf/ComponentUI.html#paint-java.awt.Graphics-javax.swing.JComponent-), [update](../../../../javax/swing/plaf/ComponentUI.html#update-java.awt.Graphics-javax.swing.JComponent-)` * ### Methods inherited from class java.lang.[Object](../../../../java/lang/Object.html "class in java.lang") `[clone](../../../../java/lang/Object.html#clone--), [equals](../../../../java/lang/Object.html#equals-java.lang.Object-), [finalize](../../../../java/lang/Object.html#finalize--), [getClass](../../../../java/lang/Object.html#getClass--), [hashCode](../../../../java/lang/Object.html#hashCode--), [notify](../../../../java/lang/Object.html#notify--), [notifyAll](../../../../java/lang/Object.html#notifyAll--), [toString](../../../../java/lang/Object.html#toString--), [wait](../../../../java/lang/Object.html#wait--), [wait](../../../../java/lang/Object.html#wait-long-), [wait](../../../../java/lang/Object.html#wait-long-int-)`
Field Detail
* #### directoryIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") directoryIcon * #### fileIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") fileIcon * #### computerIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") computerIcon * #### hardDriveIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") hardDriveIcon * #### floppyDriveIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") floppyDriveIcon * #### newFolderIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") newFolderIcon * #### upFolderIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") upFolderIcon * #### homeFolderIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") homeFolderIcon * #### listViewIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") listViewIcon * #### detailsViewIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") detailsViewIcon * #### viewMenuIcon protected [Icon](../../../../javax/swing/Icon.html "interface in javax.swing") viewMenuIcon * #### saveButtonMnemonic protected int saveButtonMnemonic * #### openButtonMnemonic protected int openButtonMnemonic * #### cancelButtonMnemonic protected int cancelButtonMnemonic * #### updateButtonMnemonic protected int updateButtonMnemonic * #### helpButtonMnemonic protected int helpButtonMnemonic * #### directoryOpenButtonMnemonic protected int directoryOpenButtonMnemonic The mnemonic keycode used for the approve button when a directory is selected and the current selection mode is FILES\_ONLY. Since: 1.4 * #### saveButtonText protected [String](../../../../java/lang/String.html "class in java.lang") saveButtonText * #### openButtonText protected [String](../../../../java/lang/String.html "class in java.lang") openButtonText * #### cancelButtonText protected [String](../../../../java/lang/String.html "class in java.lang") cancelButtonText * #### updateButtonText protected [String](../../../../java/lang/String.html "class in java.lang") updateButtonText * #### helpButtonText protected [String](../../../../java/lang/String.html "class in java.lang") helpButtonText * #### directoryOpenButtonText protected [String](../../../../java/lang/String.html "class in java.lang") directoryOpenButtonText The label text displayed on the approve button when a directory is selected and the current selection mode is FILES\_ONLY. Since: 1.4 * #### saveButtonToolTipText protected [String](../../../../java/lang/String.html "class in java.lang") saveButtonToolTipText * #### openButtonToolTipText protected [String](../../../../java/lang/String.html "class in java.lang") openButtonToolTipText * #### cancelButtonToolTipText protected [String](../../../../java/lang/String.html "class in java.lang") cancelButtonToolTipText * #### updateButtonToolTipText protected [String](../../../../java/lang/String.html "class in java.lang") updateButtonToolTipText * #### helpButtonToolTipText protected [String](../../../../java/lang/String.html "class in java.lang") helpButtonToolTipText * #### directoryOpenButtonToolTipText protected [String](../../../../java/lang/String.html "class in java.lang") directoryOpenButtonToolTipText The tooltip text displayed on the approve button when a directory is selected and the current selection mode is FILES\_ONLY. Since: 1.4
Constructor Detail
* #### BasicFileChooserUI public BasicFileChooserUI([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") b)
Method Detail
* #### createUI public static [ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf") createUI([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) Creates a `BasicFileChooserUI` implementation for the specified component. By default the `BasicLookAndFeel` class uses`createUI` methods of all basic UIs classes to instantiate UIs. Parameters: `c` \- the `JFileChooser` which needs a UI Returns: the `BasicFileChooserUI` object Since: 1.7 See Also: [UIDefaults.getUI(JComponent)](../../../../javax/swing/UIDefaults.html#getUI-javax.swing.JComponent-) * #### installUI public void installUI([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) Configures the specified component appropriately for the look and feel. This method is invoked when the `ComponentUI` instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following: 1. Install default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should _not_ be overridden. 2. Install a `LayoutManager` on the component if necessary. 3. Create/add any required sub-components to the component. 4. Create/install event listeners on the component. 5. Create/install a `PropertyChangeListener` on the component in order to detect and respond to component property changes appropriately. 6. Install keyboard UI (mnemonics, traversal, etc.) on the component. 7. Initialize any appropriate instance data. Overrides: `[installUI](../../../../javax/swing/plaf/ComponentUI.html#installUI-javax.swing.JComponent-)` in class `[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf")` Parameters: `c` \- the component where this UI delegate is being installed See Also: [ComponentUI.uninstallUI(javax.swing.JComponent)](../../../../javax/swing/plaf/ComponentUI.html#uninstallUI-javax.swing.JComponent-), [JComponent.setUI(javax.swing.plaf.ComponentUI)](../../../../javax/swing/JComponent.html#setUI-javax.swing.plaf.ComponentUI-), [JComponent.updateUI()](../../../../javax/swing/JComponent.html#updateUI--) * #### uninstallUI public void uninstallUI([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) Reverses configuration which was done on the specified component during`installUI`. This method is invoked when this`UIComponent` instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in `installUI`, being careful to leave the `JComponent` instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following: 1. Remove any UI-set borders from the component. 2. Remove any UI-set layout managers on the component. 3. Remove any UI-added sub-components from the component. 4. Remove any UI-added event/property listeners from the component. 5. Remove any UI-installed keyboard UI from the component. 6. Nullify any allocated instance data objects to allow for GC. Overrides: `[uninstallUI](../../../../javax/swing/plaf/ComponentUI.html#uninstallUI-javax.swing.JComponent-)` in class `[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf")` Parameters: `c` \- the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components See Also: [ComponentUI.installUI(javax.swing.JComponent)](../../../../javax/swing/plaf/ComponentUI.html#installUI-javax.swing.JComponent-), [JComponent.updateUI()](../../../../javax/swing/JComponent.html#updateUI--) * #### installComponents public void installComponents([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### uninstallComponents public void uninstallComponents([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### installListeners protected void installListeners([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### uninstallListeners protected void uninstallListeners([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### installDefaults protected void installDefaults([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### installIcons protected void installIcons([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### installStrings protected void installStrings([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### uninstallDefaults protected void uninstallDefaults([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### uninstallIcons protected void uninstallIcons([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### uninstallStrings protected void uninstallStrings([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### createModel protected void createModel() * #### getModel public [BasicDirectoryModel](../../../../javax/swing/plaf/basic/BasicDirectoryModel.html "class in javax.swing.plaf.basic") getModel() * #### createPropertyChangeListener public [PropertyChangeListener](../../../../java/beans/PropertyChangeListener.html "interface in java.beans") createPropertyChangeListener([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### getFileName public [String](../../../../java/lang/String.html "class in java.lang") getFileName() * #### getDirectoryName public [String](../../../../java/lang/String.html "class in java.lang") getDirectoryName() * #### setFileName public void setFileName([String](../../../../java/lang/String.html "class in java.lang") filename) * #### setDirectoryName public void setDirectoryName([String](../../../../java/lang/String.html "class in java.lang") dirname) * #### rescanCurrentDirectory public void rescanCurrentDirectory([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) Specified by: `[rescanCurrentDirectory](../../../../javax/swing/plaf/FileChooserUI.html#rescanCurrentDirectory-javax.swing.JFileChooser-)` in class `[FileChooserUI](../../../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")` * #### ensureFileIsVisible public void ensureFileIsVisible([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc, [File](../../../../java/io/File.html "class in java.io") f) Specified by: `[ensureFileIsVisible](../../../../javax/swing/plaf/FileChooserUI.html#ensureFileIsVisible-javax.swing.JFileChooser-java.io.File-)` in class `[FileChooserUI](../../../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")` * #### getFileChooser public [JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") getFileChooser() * #### getAccessoryPanel public [JPanel](../../../../javax/swing/JPanel.html "class in javax.swing") getAccessoryPanel() * #### getApproveButton protected [JButton](../../../../javax/swing/JButton.html "class in javax.swing") getApproveButton([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### getDefaultButton public [JButton](../../../../javax/swing/JButton.html "class in javax.swing") getDefaultButton([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) Returns default button for current `LookAndFeel`.`JFileChooser` will use this button as default button for dialog windows. Overrides: `[getDefaultButton](../../../../javax/swing/plaf/FileChooserUI.html#getDefaultButton-javax.swing.JFileChooser-)` in class `[FileChooserUI](../../../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")` * #### getApproveButtonToolTipText public [String](../../../../java/lang/String.html "class in java.lang") getApproveButtonToolTipText([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### clearIconCache public void clearIconCache() * #### createDoubleClickListener protected [MouseListener](../../../../java/awt/event/MouseListener.html "interface in java.awt.event") createDoubleClickListener([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc, [JList](../../../../javax/swing/JList.html "class in javax.swing") list) * #### createListSelectionListener public [ListSelectionListener](../../../../javax/swing/event/ListSelectionListener.html "interface in javax.swing.event") createListSelectionListener([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### isDirectorySelected protected boolean isDirectorySelected() Property to remember whether a directory is currently selected in the UI. Returns: `true` iff a directory is currently selected. Since: 1.4 * #### setDirectorySelected protected void setDirectorySelected(boolean b) Property to remember whether a directory is currently selected in the UI. This is normally called by the UI on a selection event. Parameters: `b` \- iff a directory is currently selected. Since: 1.4 * #### getDirectory protected [File](../../../../java/io/File.html "class in java.io") getDirectory() Property to remember the directory that is currently selected in the UI. Returns: the value of the `directory` property Since: 1.4 See Also: [setDirectory(java.io.File)](../../../../javax/swing/plaf/basic/BasicFileChooserUI.html#setDirectory-java.io.File-) * #### setDirectory protected void setDirectory([File](../../../../java/io/File.html "class in java.io") f) Property to remember the directory that is currently selected in the UI. This is normally called by the UI on a selection event. Parameters: `f` \- the `File` object representing the directory that is currently selected Since: 1.4 * #### getAcceptAllFileFilter public [FileFilter](../../../../javax/swing/filechooser/FileFilter.html "class in javax.swing.filechooser") getAcceptAllFileFilter([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) Returns the default accept all file filter Specified by: `[getAcceptAllFileFilter](../../../../javax/swing/plaf/FileChooserUI.html#getAcceptAllFileFilter-javax.swing.JFileChooser-)` in class `[FileChooserUI](../../../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")` * #### getFileView public [FileView](../../../../javax/swing/filechooser/FileView.html "class in javax.swing.filechooser") getFileView([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) Specified by: `[getFileView](../../../../javax/swing/plaf/FileChooserUI.html#getFileView-javax.swing.JFileChooser-)` in class `[FileChooserUI](../../../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")` * #### getDialogTitle public [String](../../../../java/lang/String.html "class in java.lang") getDialogTitle([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) Returns the title of this dialog Specified by: `[getDialogTitle](../../../../javax/swing/plaf/FileChooserUI.html#getDialogTitle-javax.swing.JFileChooser-)` in class `[FileChooserUI](../../../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")` * #### getApproveButtonMnemonic public int getApproveButtonMnemonic([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) * #### getApproveButtonText public [String](../../../../java/lang/String.html "class in java.lang") getApproveButtonText([JFileChooser](../../../../javax/swing/JFileChooser.html "class in javax.swing") fc) Specified by: `[getApproveButtonText](../../../../javax/swing/plaf/FileChooserUI.html#getApproveButtonText-javax.swing.JFileChooser-)` in class `[FileChooserUI](../../../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")` * #### getNewFolderAction public [Action](../../../../javax/swing/Action.html "interface in javax.swing") getNewFolderAction() * #### getGoHomeAction public [Action](../../../../javax/swing/Action.html "interface in javax.swing") getGoHomeAction() * #### getChangeToParentDirectoryAction public [Action](../../../../javax/swing/Action.html "interface in javax.swing") getChangeToParentDirectoryAction() * #### getApproveSelectionAction public [Action](../../../../javax/swing/Action.html "interface in javax.swing") getApproveSelectionAction() * #### getCancelSelectionAction public [Action](../../../../javax/swing/Action.html "interface in javax.swing") getCancelSelectionAction() * #### getUpdateAction public [Action](../../../../javax/swing/Action.html "interface in javax.swing") getUpdateAction()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.