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
| Modifier and Type | Class | Description |
|---|---|---|
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 |
Deprecated. As of JDK version 9. |
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 |
Deprecated. As of JDK version 9. |
Nested classes/interfaces declared in class BasicFileChooserUI
BasicFileChooserUI.AcceptAllFileFilter, BasicFileChooserUI.ApproveSelectionAction, BasicFileChooserUI.BasicFileView, BasicFileChooserUI.CancelSelectionAction, BasicFileChooserUI.ChangeToParentDirectoryAction, BasicFileChooserUI.DoubleClickListener, BasicFileChooserUI.GoHomeAction, BasicFileChooserUI.NewFolderAction, BasicFileChooserUI.SelectionListener, BasicFileChooserUI.UpdateAction | Modifier and Type | Class | Description |
|---|---|---|
protected class |
BasicFileChooserUI.AcceptAllFileFilter |
Accept all file filter. |
protected class |
BasicFileChooserUI.ApproveSelectionAction |
Responds to an Open or Save request |
protected class |
BasicFileChooserUI.BasicFileView |
A basic file view. |
protected class |
BasicFileChooserUI.CancelSelectionAction |
Responds to a cancel request. |
protected class |
BasicFileChooserUI.ChangeToParentDirectoryAction |
Change to parent directory action. |
protected class |
BasicFileChooserUI.DoubleClickListener |
A double click listener. |
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 |
A selection listener. |
protected class |
BasicFileChooserUI.UpdateAction |
Rescans the files in the current directory |
Field Summary
Fields declared in class 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 | Modifier and Type | Field | Description |
|---|---|---|
protected int |
cancelButtonMnemonic |
Cancel button mnemonic |
protected String |
cancelButtonText |
Cancel button text |
protected String |
cancelButtonToolTipText |
Cancel button tool tip text |
protected Icon |
computerIcon |
Computer icon |
protected Icon |
detailsViewIcon |
Details view icon |
protected Icon |
directoryIcon |
Directory icon |
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 |
File icon |
protected Icon |
floppyDriveIcon |
Floppy drive icon |
protected Icon |
hardDriveIcon |
Hard drive icon |
protected int |
helpButtonMnemonic |
Help button mnemonic |
protected String |
helpButtonText |
Help button text |
protected String |
helpButtonToolTipText |
Help button tool tip text |
protected Icon |
homeFolderIcon |
Home folder icon |
protected Icon |
listViewIcon |
List view icon |
protected Icon |
newFolderIcon |
New folder icon |
protected int |
openButtonMnemonic |
Open button mnemonic |
protected String |
openButtonText |
Open button text |
protected String |
openButtonToolTipText |
Open button tool tip text |
protected int |
saveButtonMnemonic |
Save button mnemonic |
protected String |
saveButtonText |
Save button text |
protected String |
saveButtonToolTipText |
Save button tool tip text |
protected int |
updateButtonMnemonic |
Update button mnemonic |
protected String |
updateButtonText |
Update button text |
protected String |
updateButtonToolTipText |
Update button tool tip text |
protected Icon |
upFolderIcon |
Up folder icon |
protected Icon |
viewMenuIcon |
View menu icon |
Constructor Summary
| Constructor | Description |
|---|---|
MetalFileChooserUI |
Constructs a new instance of MetalFileChooserUI. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
addControlButtons() |
Adds control buttons to bottom panel. |
protected ActionMap |
createActionMap() |
Constructs an instance of ActionMap. |
protected JPanel |
createDetailsView |
Constructs a details view. |
protected MetalFileChooserUI.DirectoryComboBoxModel |
createDirectoryComboBoxModel |
Constructs a new instance of DataModel for DirectoryComboBox. |
protected MetalFileChooserUI.FilterComboBoxModel |
createFilterComboBoxModel() |
Constructs a DataModel for types ComboBox. |
protected MetalFileChooserUI.FilterComboBoxRenderer |
createFilterComboBoxRenderer() |
Constructs a Renderer for types ComboBox. |
protected JPanel |
createList |
Constructs a details view. |
ListSelectionListener |
createListSelectionListener |
Creates a selection listener for the list of files and directories. |
static ComponentUI |
createUI |
Constructs a new instance of MetalFileChooserUI. |
protected ActionMap |
getActionMap() |
Returns an instance of ActionMap. |
protected JPanel |
getBottomPanel() |
Returns the bottom panel. |
protected JPanel |
getButtonPanel() |
Returns the button panel. |
String |
getDirectoryName() |
Returns the directory name. |
Dimension |
getMaximumSize |
Returns the maximum size of the JFileChooser. |
Dimension |
getMinimumSize |
Returns the minimum size of the JFileChooser. |
Dimension |
getPreferredSize |
Returns the preferred size of the specified JFileChooser. |
protected void |
removeControlButtons() |
Removes control buttons from bottom panel. |
void |
setDirectoryName |
Sets the directory name. |
protected void |
setDirectorySelected |
Property to remember whether a directory is currently selected in the UI. |
void |
valueChanged |
Invokes when ListSelectionEvent occurs. |
Methods declared in class BasicFileChooserUI
clearIconCache, createDoubleClickListener, createModel, createPropertyChangeListener, ensureFileIsVisible, getAcceptAllFileFilter, getAccessoryPanel, getApproveButton, getApproveButtonMnemonic, getApproveButtonText, getApproveButtonToolTipText, getApproveSelectionAction, getCancelSelectionAction, getChangeToParentDirectoryAction, getDialogTitle, getDirectory, getFileChooser, getFileName, getFileView, getGoHomeAction, getModel, getNewFolderAction, getUpdateAction, installComponents, installDefaults, installIcons, installListeners, installStrings, installUI, isDirectorySelected, rescanCurrentDirectory, setDirectory, setFileName, uninstallComponents, uninstallDefaults, uninstallIcons, uninstallListeners, uninstallStrings, uninstallUI | Modifier and Type | Method | Description |
|---|---|---|
void |
clearIconCache() |
Clears the icon cache. |
protected MouseListener |
createDoubleClickListener |
Creates a double click listener. |
protected void |
createModel() |
Creates the model. |
PropertyChangeListener |
createPropertyChangeListener |
Creates the property change listener. |
void |
ensureFileIsVisible |
Ensure the file in question is visible. |
FileFilter |
getAcceptAllFileFilter |
Returns the default accept all file filter |
JPanel |
getAccessoryPanel() |
Returns the accessory panel. |
protected JButton |
getApproveButton |
Returns the approve button. |
int |
getApproveButtonMnemonic |
Returns the approve button mnemonic. |
String |
getApproveButtonText |
Returns approve button text. |
String |
getApproveButtonToolTipText |
Returns the approve button tool tip. |
Action |
getApproveSelectionAction() |
Returns an approve selection action. |
Action |
getCancelSelectionAction() |
Returns a cancel selection action. |
Action |
getChangeToParentDirectoryAction() |
Returns a change to parent directory action. |
String |
getDialogTitle |
Returns the title of this dialog |
protected File |
getDirectory() |
Property to remember the directory that is currently selected in the UI. |
JFileChooser |
getFileChooser() |
Returns the file chooser. |
String |
getFileName() |
Returns the file name. |
FileView |
getFileView |
Returns a file view. |
Action |
getGoHomeAction() |
Returns a go home action. |
BasicDirectoryModel |
getModel() |
Returns the model. |
Action |
getNewFolderAction() |
Returns a new folder action. |
Action |
getUpdateAction() |
Returns an update action. |
void |
installComponents |
Installs the components. |
protected void |
installDefaults |
Installs the defaults. |
protected void |
installIcons |
Installs the icons. |
protected void |
installListeners |
Installs the listeners. |
protected void |
installStrings |
Installs the strings. |
void |
installUI |
Installs the UI. |
protected boolean |
isDirectorySelected() |
Property to remember whether a directory is currently selected in the UI. |
void |
rescanCurrentDirectory |
Rescan the current directory. |
protected void |
setDirectory |
Property to remember the directory that is currently selected in the UI. |
void |
setFileName |
Sets the file name. |
void |
uninstallComponents |
Uninstalls the components. |
protected void |
uninstallDefaults |
Uninstalls the defaults. |
protected void |
uninstallIcons |
Uninstalls the icons. |
protected void |
uninstallListeners |
Uninstalls the listeners. |
protected void |
uninstallStrings |
Uninstalls the strings. |
void |
uninstallUI |
Uninstalls the UI. |
Methods declared in class FileChooserUI
getDefaultButton | Modifier and Type | Method | Description |
|---|---|---|
JButton |
getDefaultButton |
Returns default button for current LookAndFeel. |
Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, paint, update | Modifier and Type | Method | Description |
|---|---|---|
boolean |
contains |
Returns true if the specified x,y location is contained within the look and feel's defined shape of the specified component. |
Accessible |
getAccessibleChild |
Returns the ith Accessible child of the object. |
int |
getAccessibleChildrenCount |
Returns the number of accessible children in the object. |
int |
getBaseline |
Returns the baseline. |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior |
Returns an enum indicating how the baseline of the component changes as the size changes. |
void |
paint |
Paints the specified component appropriately for the look and feel. |
void |
update |
Notifies this UI delegate that it is time to paint the specified component. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
toString() |
Returns a string representation of the object. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
MetalFileChooserUI
public MetalFileChooserUI(JFileChooser filechooser)
Constructs a new instance of
MetalFileChooserUI.- Parameters:
-
filechooser- aJFileChooser
Method Details
createUI
public static ComponentUI createUI(JComponent c)
Constructs a new instance of
MetalFileChooserUI.- Parameters:
-
c- a component - Returns:
- a new instance of
MetalFileChooserUI
getButtonPanel
protected JPanel getButtonPanel()
Returns the button panel.
- Returns:
- the button panel
getBottomPanel
protected JPanel getBottomPanel()
Returns the bottom panel.
- Returns:
- the bottom panel
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- aJFileChooser - Returns:
- the list
createDetailsView
protected JPanel createDetailsView(JFileChooser fc)
Constructs a details view.
- Parameters:
-
fc- aJFileChooser - Returns:
- the details view
createListSelectionListener
public ListSelectionListener createListSelectionListener(JFileChooser fc)
Creates a selection listener for the list of files and directories.
- Overrides:
-
createListSelectionListenerin classBasicFileChooserUI - Parameters:
-
fc- aJFileChooser - Returns:
- a
ListSelectionListener
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:
-
getPreferredSizein classComponentUI - Parameters:
-
c- aJFileChooser - Returns:
- a
Dimensionspecifying the preferred width and height of the file chooser - See Also:
getMinimumSize
public Dimension getMinimumSize(JComponent c)
Returns the minimum size of the
JFileChooser.- Overrides:
-
getMinimumSizein classComponentUI - Parameters:
-
c- aJFileChooser - Returns:
- a
Dimensionspecifying the minimum width and height of the file chooser - See Also:
getMaximumSize
public Dimension getMaximumSize(JComponent c)
Returns the maximum size of the
JFileChooser.- Overrides:
-
getMaximumSizein classComponentUI - Parameters:
-
c- aJFileChooser - Returns:
- a
Dimensionspecifying the maximum width and height of the file chooser - See Also:
removeControlButtons
protected void removeControlButtons()
Removes control buttons from bottom panel.
addControlButtons
protected void addControlButtons()
Adds control buttons to bottom panel.
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:
-
setDirectorySelectedin classBasicFileChooserUI - Parameters:
-
directorySelected- if a directory is currently selected. - Since:
- 1.4
getDirectoryName
public String getDirectoryName()
Returns the directory name.
- Overrides:
-
getDirectoryNamein classBasicFileChooserUI - Returns:
- the directory name
setDirectoryName
public void setDirectoryName(String dirname)
Sets the directory name.
- Overrides:
-
setDirectoryNamein classBasicFileChooserUI - Parameters:
-
dirname- the directory name
createDirectoryComboBoxModel
protected MetalFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(JFileChooser fc)
Constructs a new instance of
DataModel for DirectoryComboBox.- Parameters:
-
fc- aJFileChooser - Returns:
- a new instance of
DataModelforDirectoryComboBox
createFilterComboBoxRenderer
protected MetalFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()
Constructs a
Renderer for types ComboBox.- Returns:
- a
Rendererfor typesComboBox
createFilterComboBoxModel
protected MetalFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()
Constructs a
DataModel for types ComboBox.- Returns:
- a
DataModelfor typesComboBox
valueChanged
public void valueChanged(ListSelectionEvent e)
Invokes when
ListSelectionEvent occurs.- Parameters:
-
e- an instance ofListSelectionEvent
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.