Module java.desktop
Package javax.swing.plaf.metal

## Class MetalFileChooserUI

- java.lang.Object
- - javax.swing.plaf.ComponentUI
  - - javax.swing.plaf.FileChooserUI
    - - javax.swing.plaf.basic.BasicFileChooserUI
      - - javax.swing.plaf.metal.MetalFileChooserUI

    public class MetalFileChooserUI
    extends BasicFileChooserUI

Metal L&F implementation of a FileChooser.

### Nested Class Summary

Nested Classes
`protected class` `MetalFileChooserUI.DirectoryComboBoxAction` Acts when DirectoryComboBox has changed the selected item.
`protected class` `MetalFileChooserUI.DirectoryComboBoxModel` Data model for a type-face selection combo-box.
`protected class` `MetalFileChooserUI.FileRenderer` Obsolete class, not used in this version.
`protected class` `MetalFileChooserUI.FilterComboBoxModel` Data model for a type-face selection combo-box.
`class` `MetalFileChooserUI.FilterComboBoxRenderer` Render different type sizes and styles.
`protected class` `MetalFileChooserUI.SingleClickListener` Obsolete class, not used in this version.

### Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicFileChooserUI

`BasicFileChooserUI.AcceptAllFileFilter, BasicFileChooserUI.ApproveSelectionAction, BasicFileChooserUI.BasicFileView, BasicFileChooserUI.CancelSelectionAction, BasicFileChooserUI.ChangeToParentDirectoryAction, BasicFileChooserUI.DoubleClickListener, BasicFileChooserUI.GoHomeAction, BasicFileChooserUI.NewFolderAction, BasicFileChooserUI.SelectionListener, BasicFileChooserUI.UpdateAction`

### Field Summary

### Fields inherited from class javax.swing.plaf.basic.BasicFileChooserUI

`cancelButtonMnemonic, cancelButtonText, cancelButtonToolTipText, computerIcon, detailsViewIcon, directoryIcon, directoryOpenButtonMnemonic, directoryOpenButtonText, directoryOpenButtonToolTipText, fileIcon, floppyDriveIcon, hardDriveIcon, helpButtonMnemonic, helpButtonText, helpButtonToolTipText, homeFolderIcon, listViewIcon, newFolderIcon, openButtonMnemonic, openButtonText, openButtonToolTipText, saveButtonMnemonic, saveButtonText, saveButtonToolTipText, updateButtonMnemonic, updateButtonText, updateButtonToolTipText, upFolderIcon, viewMenuIcon`

### Constructor Summary

Constructors
Constructor and Description
`MetalFileChooserUI(JFileChooser filechooser)` Constructs a new instance of `MetalFileChooserUI`.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `addControlButtons()` Adds control buttons to bottom panel.
`protected ActionMap` `createActionMap()` Constructs an instance of `ActionMap`.
`protected JPanel` `createDetailsView(JFileChooser fc)` Constructs a details view.
`protected MetalFileChooserUI.DirectoryComboBoxModel` `createDirectoryComboBoxModel(JFileChooser fc)` Constructs a new instance of `DataModel` for `DirectoryComboBox`.
`protected javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxRenderer` `createDirectoryComboBoxRenderer(JFileChooser fc)` Constructs a new instance of `DirectoryComboBoxRenderer`.
`protected MetalFileChooserUI.FilterComboBoxModel` `createFilterComboBoxModel()` Constructs a `DataModel` for types `ComboBox`.
`protected MetalFileChooserUI.FilterComboBoxRenderer` `createFilterComboBoxRenderer()` Constructs a `Renderer` for types `ComboBox`.
`protected JPanel` `createList(JFileChooser fc)` Constructs a details view.
`ListSelectionListener` `createListSelectionListener(JFileChooser fc)` Creates a selection listener for the list of files and directories.
`PropertyChangeListener` `createPropertyChangeListener(JFileChooser fc)` Creates the property change listener.
`static ComponentUI` `createUI(JComponent c)` Constructs a new instance of `MetalFileChooserUI`.
`void` `ensureFileIsVisible(JFileChooser fc, File f)` Ensure the file in question is visible.
`protected ActionMap` `getActionMap()` Returns an instance of `ActionMap`.
`protected JButton` `getApproveButton(JFileChooser fc)` Returns the approve button.
`protected JPanel` `getBottomPanel()` Returns the bottom panel.
`protected JPanel` `getButtonPanel()` Returns the button panel.
`String` `getDirectoryName()` Returns the directory name.
`String` `getFileName()` Returns the file name.
`Dimension` `getMaximumSize(JComponent c)` Returns the maximum size of the `JFileChooser`.
`Dimension` `getMinimumSize(JComponent c)` Returns the minimum size of the `JFileChooser`.
`Dimension` `getPreferredSize(JComponent c)` Returns the preferred size of the specified `JFileChooser`.
`void` `installComponents(JFileChooser fc)` Installs the components.
`protected void` `installListeners(JFileChooser fc)` Installs the listeners.
`protected void` `installStrings(JFileChooser fc)` Installs the strings.
`void` `installUI(JComponent c)` Installs the UI.
`protected void` `removeControlButtons()` Removes control buttons from bottom panel.
`void` `rescanCurrentDirectory(JFileChooser fc)` Rescan the current directory.
`void` `setDirectoryName(String dirname)` Sets the directory name.
`protected void` `setDirectorySelected(boolean directorySelected)` Property to remember whether a directory is currently selected in the UI.
`void` `setFileName(String filename)` Sets the file name.
`void` `uninstallComponents(JFileChooser fc)` Uninstalls the components.
`void` `uninstallUI(JComponent c)` Uninstalls the UI.
`void` `valueChanged(ListSelectionEvent e)` Invokes when `ListSelectionEvent` occurs.

### Methods inherited from class javax.swing.plaf.basic.BasicFileChooserUI

`clearIconCache, createDoubleClickListener, createModel, getAcceptAllFileFilter, getAccessoryPanel, getApproveButtonMnemonic, getApproveButtonText, getApproveButtonToolTipText, getApproveSelectionAction, getCancelSelectionAction, getChangeToParentDirectoryAction, getDefaultButton, getDialogTitle, getDirectory, getFileChooser, getFileView, getGoHomeAction, getModel, getNewFolderAction, getUpdateAction, installDefaults, installIcons, isDirectorySelected, setDirectory, uninstallDefaults, uninstallIcons, uninstallListeners, uninstallStrings`

### Methods inherited from class javax.swing.plaf.ComponentUI

`contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, paint, update`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MetalFileChooserUI

    public MetalFileChooserUI(JFileChooser filechooser)

Constructs a new instance of `MetalFileChooserUI`.

Parameters:
  `filechooser` - a `JFileChooser`

### Method Detail

#### createUI

    public static ComponentUI createUI(JComponent c)

Constructs a new instance of `MetalFileChooserUI`.

Parameters:
  `c` - a component
Returns:
  a new instance of `MetalFileChooserUI`

#### installUI

    public void installUI(JComponent c)

Description copied from class: `BasicFileChooserUI`
Installs the UI.

Overrides:
  `installUI` in class `BasicFileChooserUI`
Parameters:
  `c` - the component
See Also:
  `ComponentUI.uninstallUI(javax.swing.JComponent)`, `JComponent.setUI(javax.swing.plaf.ComponentUI)`, `JComponent.updateUI()`

#### uninstallComponents

    public void uninstallComponents(JFileChooser fc)

Description copied from class: `BasicFileChooserUI`
Uninstalls the components.

Overrides:
  `uninstallComponents` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser

#### installComponents

    public void installComponents(JFileChooser fc)

Description copied from class: `BasicFileChooserUI`
Installs the components.

Overrides:
  `installComponents` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser

#### getButtonPanel

    protected JPanel getButtonPanel()

Returns the button panel.

Returns:
  the button panel

#### getBottomPanel

    protected JPanel getBottomPanel()

Returns the bottom panel.

Returns:
  the bottom panel

#### installStrings

    protected void installStrings(JFileChooser fc)

Description copied from class: `BasicFileChooserUI`
Installs the strings.

Overrides:
  `installStrings` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser

#### installListeners

    protected void installListeners(JFileChooser fc)

Description copied from class: `BasicFileChooserUI`
Installs the listeners.

Overrides:
  `installListeners` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser

#### getActionMap

    protected ActionMap getActionMap()

Returns an instance of `ActionMap`.

Returns:
  an instance of `ActionMap`

#### createActionMap

    protected ActionMap createActionMap()

Constructs an instance of `ActionMap`.

Returns:
  an instance of `ActionMap`

#### createList

    protected JPanel createList(JFileChooser fc)

Constructs a details view.

Parameters:
  `fc` - a `JFileChooser`
Returns:
  the list

#### createDetailsView

    protected JPanel createDetailsView(JFileChooser fc)

Constructs a details view.

Parameters:
  `fc` - a `JFileChooser`
Returns:
  the details view

#### createListSelectionListener

    public ListSelectionListener createListSelectionListener(JFileChooser fc)

Creates a selection listener for the list of files and directories.

Overrides:
  `createListSelectionListener` in class `BasicFileChooserUI`
Parameters:
  `fc` - a `JFileChooser`
Returns:
  a `ListSelectionListener`

#### uninstallUI

    public void uninstallUI(JComponent c)

Description copied from class: `BasicFileChooserUI`
Uninstalls the UI.

Overrides:
  `uninstallUI` in class `BasicFileChooserUI`
Parameters:
  `c` - the component
See Also:
  `ComponentUI.installUI(javax.swing.JComponent)`, `JComponent.updateUI()`

#### getPreferredSize

    public Dimension getPreferredSize(JComponent c)

Returns the preferred size of the specified `JFileChooser`. The preferred size is at least as large, in both height and width, as the preferred size recommended by the file chooser's layout manager.

Overrides:
  `getPreferredSize` in class `ComponentUI`
Parameters:
  `c` - a `JFileChooser`
Returns:
  a `Dimension` specifying the preferred width and height of the file chooser
See Also:
  `JComponent.getPreferredSize()`, `LayoutManager.preferredLayoutSize(java.awt.Container)`

#### getMinimumSize

    public Dimension getMinimumSize(JComponent c)

Returns the minimum size of the `JFileChooser`.

Overrides:
  `getMinimumSize` in class `ComponentUI`
Parameters:
  `c` - a `JFileChooser`
Returns:
  a `Dimension` specifying the minimum width and height of the file chooser
See Also:
  `JComponent.getMinimumSize()`, `LayoutManager.minimumLayoutSize(java.awt.Container)`, `ComponentUI.getPreferredSize(javax.swing.JComponent)`

#### getMaximumSize

    public Dimension getMaximumSize(JComponent c)

Returns the maximum size of the `JFileChooser`.

Overrides:
  `getMaximumSize` in class `ComponentUI`
Parameters:
  `c` - a `JFileChooser`
Returns:
  a `Dimension` specifying the maximum width and height of the file chooser
See Also:
  `JComponent.getMaximumSize()`, `LayoutManager2.maximumLayoutSize(java.awt.Container)`

#### createPropertyChangeListener

    public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)

Description copied from class: `BasicFileChooserUI`
Creates the property change listener.

Overrides:
  `createPropertyChangeListener` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser
Returns:
  the property change listener

#### removeControlButtons

    protected void removeControlButtons()

Removes control buttons from bottom panel.

#### addControlButtons

    protected void addControlButtons()

Adds control buttons to bottom panel.

#### ensureFileIsVisible

    public void ensureFileIsVisible(JFileChooser fc,
                                    File f)

Description copied from class: `BasicFileChooserUI`
Ensure the file in question is visible.

Overrides:
  `ensureFileIsVisible` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser
  `f` - the file

#### rescanCurrentDirectory

    public void rescanCurrentDirectory(JFileChooser fc)

Description copied from class: `BasicFileChooserUI`
Rescan the current directory.

Overrides:
  `rescanCurrentDirectory` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser

#### getFileName

    public String getFileName()

Description copied from class: `BasicFileChooserUI`
Returns the file name.

Overrides:
  `getFileName` in class `BasicFileChooserUI`
Returns:
  the file name

#### setFileName

    public void setFileName(String filename)

Description copied from class: `BasicFileChooserUI`
Sets the file name.

Overrides:
  `setFileName` in class `BasicFileChooserUI`
Parameters:
  `filename` - the file name

#### setDirectorySelected

    protected void setDirectorySelected(boolean directorySelected)

Property to remember whether a directory is currently selected in the UI. This is normally called by the UI on a selection event.

Overrides:
  `setDirectorySelected` in class `BasicFileChooserUI`
Parameters:
  `directorySelected` - if a directory is currently selected.
Since:
  1.4

#### getDirectoryName

    public String getDirectoryName()

Returns the directory name.

Overrides:
  `getDirectoryName` in class `BasicFileChooserUI`
Returns:
  the directory name

#### setDirectoryName

    public void setDirectoryName(String dirname)

Sets the directory name.

Overrides:
  `setDirectoryName` in class `BasicFileChooserUI`
Parameters:
  `dirname` - the directory name

#### createDirectoryComboBoxRenderer

    protected javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(JFileChooser fc)

Constructs a new instance of `DirectoryComboBoxRenderer`.

Parameters:
  `fc` - a `JFileChooser`
Returns:
  a new instance of `DirectoryComboBoxRenderer`

#### createDirectoryComboBoxModel

    protected MetalFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(JFileChooser fc)

Constructs a new instance of `DataModel` for `DirectoryComboBox`.

Parameters:
  `fc` - a `JFileChooser`
Returns:
  a new instance of `DataModel` for `DirectoryComboBox`

#### createFilterComboBoxRenderer

    protected MetalFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()

Constructs a `Renderer` for types `ComboBox`.

Returns:
  a `Renderer` for types `ComboBox`

#### createFilterComboBoxModel

    protected MetalFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()

Constructs a `DataModel` for types `ComboBox`.

Returns:
  a `DataModel` for types `ComboBox`

#### valueChanged

    public void valueChanged(ListSelectionEvent e)

Invokes when `ListSelectionEvent` occurs.

Parameters:
  `e` - an instance of `ListSelectionEvent`

#### getApproveButton

    protected JButton getApproveButton(JFileChooser fc)

Description copied from class: `BasicFileChooserUI`
Returns the approve button.

Overrides:
  `getApproveButton` in class `BasicFileChooserUI`
Parameters:
  `fc` - the file chooser
Returns:
  the approve button