javax.swing.plaf.basic

Class BasicFileChooserUI

public class BasicFileChooserUI extends FileChooserUI

A UI delegate for the {@link JFileChooser} component under the {@link BasicLookAndFeel}.
Nested Class Summary
protected classBasicFileChooserUI.AcceptAllFileFilter
A file filter that accepts all files.
protected classBasicFileChooserUI.ApproveSelectionAction
Handles a user action to approve the dialog selection.
protected classBasicFileChooserUI.BasicFileView
Provides presentation information about files and directories.
protected classBasicFileChooserUI.CancelSelectionAction
Handles an action to cancel the file chooser.
protected classBasicFileChooserUI.ChangeToParentDirectoryAction
An action to handle changes to the parent directory (for example, via a click on the "up folder" button).
protected classBasicFileChooserUI.DoubleClickListener
A mouse listener that handles double-click events.
protected classBasicFileChooserUI.GoHomeAction
An action that changes the file chooser to display the user's home directory.
protected classBasicFileChooserUI.NewFolderAction
An action that handles the creation of a new folder/directory.
protected classBasicFileChooserUI.SelectionListener
A listener for selection events in the file list.
protected classBasicFileChooserUI.UpdateAction
DOCUMENT ME!
Field Summary
protected intcancelButtonMnemonic
The localised mnemonic for the cancel button.
protected StringcancelButtonText
The localised text for the cancel button.
protected StringcancelButtonToolTipText
The localised tool tip text for the cancel button.
protected IconcomputerIcon
An icon representing a computer.
protected IcondetailsViewIcon
An icon for the "details view" button.
protected IcondirectoryIcon
An icon representing a directory.
protected intdirectoryOpenButtonMnemonic
The localised Mnemonic for the open button.
protected StringdirectoryOpenButtonText
The localised text for the open button.
protected StringdirectoryOpenButtonToolTipText
The localised tool tip text for the open button.
protected IconfileIcon
An icon representing a file.
protected IconfloppyDriveIcon
An icon representing a floppy drive.
protected IconhardDriveIcon
An icon representing a hard drive.
protected inthelpButtonMnemonic
The localised mnemonic for the "help" button.
protected StringhelpButtonText
The localised text for the "help" button.
protected StringhelpButtonToolTipText
The localised tool tip text for the help button.
protected IconhomeFolderIcon
An icon representing the user's home folder.
protected IconlistViewIcon
An icon for the "list view" button.
protected IconnewFolderIcon
An icon for the "new folder" button.
protected intopenButtonMnemonic
The localised mnemonic for the "open" button.
protected StringopenButtonText
The localised text for the "open" button.
protected StringopenButtonToolTipText
The localised tool tip text for the "open" button.
protected intsaveButtonMnemonic
The localised mnemonic for the "save" button.
protected StringsaveButtonText
The localised text for the "save" button.
protected StringsaveButtonToolTipText
The localised tool tip text for the save button.
protected intupdateButtonMnemonic
The localised mnemonic for the "update" button.
protected StringupdateButtonText
The localised text for the "update" button.
protected StringupdateButtonToolTipText
The localised tool tip text for the "update" button.
protected IconupFolderIcon
An icon for the "up folder" button.
Constructor Summary
BasicFileChooserUI(JFileChooser b)
Creates a new BasicFileChooserUI object.
Method Summary
voidclearIconCache()
Clears the icon cache.
protected MouseListenercreateDoubleClickListener(JFileChooser fc, JList list)
Creates a new listener to handle double-click events.
ListSelectionListenercreateListSelectionListener(JFileChooser fc)
Creates a new listener to handle selections in the file list.
protected voidcreateModel()
Creates a new directory model.
PropertyChangeListenercreatePropertyChangeListener(JFileChooser fc)
Creates a listener to handle changes to the properties of the given file chooser component.
static ComponentUIcreateUI(JComponent c)
Returns a UI delegate for the given component.
voidensureFileIsVisible(JFileChooser fc, File f)
NOT YET IMPLEMENTED.
FileFiltergetAcceptAllFileFilter(JFileChooser fc)
Returns the "accept all" file filter.
JPanelgetAccessoryPanel()
Returns the optional accessory panel.
protected JButtongetApproveButton(JFileChooser fc)
Returns the approve (open or save) button for the dialog.
intgetApproveButtonMnemonic(JFileChooser fc)
Returns the approve button mnemonic.
StringgetApproveButtonText(JFileChooser fc)
Returns the approve button text.
StringgetApproveButtonToolTipText(JFileChooser fc)
Returns the tool tip text for the approve (open/save) button.
ActiongetApproveSelectionAction()
Returns the action that handles events for the "approve" button.
ActiongetCancelSelectionAction()
Returns the action that handles events for the "cancel" button.
ActiongetChangeToParentDirectoryAction()
Returns the action that handles events for the "up folder" control button.
StringgetDialogTitle(JFileChooser fc)
Returns the dialog title.
protected FilegetDirectory()
Returns the current directory.
StringgetDirectoryName()
Returns the current directory name.
JFileChoosergetFileChooser()
Returns the {@link JFileChooser} component that this UI delegate represents.
StringgetFileName()
Returns the current file name.
FileViewgetFileView(JFileChooser fc)
Returns the default file view (NOT the file view from the file chooser, if there is one).
ActiongetGoHomeAction()
Creates and returns a new action that will be used with the "home folder" button.
BasicDirectoryModelgetModel()
Returns the directory model.
ActiongetNewFolderAction()
Creates and returns a new action that will be used with the "new folder" button.
ActiongetUpdateAction()
Returns the update action (an instance of {@link UpdateAction}).
voidinstallComponents(JFileChooser fc)
Creates and install the subcomponents for the file chooser.
protected voidinstallDefaults(JFileChooser fc)
Installs the defaults for this UI delegate.
protected voidinstallIcons(JFileChooser fc)
Installs the icons for this UI delegate.
protected voidinstallListeners(JFileChooser fc)
Installs the listeners required by this UI delegate.
protected voidinstallStrings(JFileChooser fc)
Installs the strings used by this UI delegate.
voidinstallUI(JComponent c)
Installs the UI for the specified component.
protected booleanisDirectorySelected()
Returns true if a directory is selected, and false otherwise.
voidrescanCurrentDirectory(JFileChooser fc)
Rescans the current directory.
protected voidsetDirectory(File f)
Sets the current directory.
voidsetDirectoryName(String dirname)
Sets the directory name (NOT IMPLEMENTED).
protected voidsetDirectorySelected(boolean selected)
Sets the flag that indicates whether the current directory is selected.
voidsetFileName(String filename)
Sets the file name.
voiduninstallComponents(JFileChooser fc)
Uninstalls the components from the file chooser.
protected voiduninstallDefaults(JFileChooser fc)
Uninstalls the defaults previously added by this UI delegate.
protected voiduninstallIcons(JFileChooser fc)
Uninstalls the icons previously added by this UI delegate.
protected voiduninstallListeners(JFileChooser fc)
Uninstalls the listeners previously installed by this UI delegate.
protected voiduninstallStrings(JFileChooser fc)
Uninstalls the strings previously added by this UI delegate.
voiduninstallUI(JComponent c)
Uninstalls this UI from the given component.

Field Detail

cancelButtonMnemonic

protected int cancelButtonMnemonic
The localised mnemonic for the cancel button.

cancelButtonText

protected String cancelButtonText
The localised text for the cancel button.

cancelButtonToolTipText

protected String cancelButtonToolTipText
The localised tool tip text for the cancel button.

computerIcon

protected Icon computerIcon
An icon representing a computer.

detailsViewIcon

protected Icon detailsViewIcon
An icon for the "details view" button.

directoryIcon

protected Icon directoryIcon
An icon representing a directory.

directoryOpenButtonMnemonic

protected int directoryOpenButtonMnemonic
The localised Mnemonic for the open button.

directoryOpenButtonText

protected String directoryOpenButtonText
The localised text for the open button.

directoryOpenButtonToolTipText

protected String directoryOpenButtonToolTipText
The localised tool tip text for the open button.

fileIcon

protected Icon fileIcon
An icon representing a file.

floppyDriveIcon

protected Icon floppyDriveIcon
An icon representing a floppy drive.

hardDriveIcon

protected Icon hardDriveIcon
An icon representing a hard drive.

helpButtonMnemonic

protected int helpButtonMnemonic
The localised mnemonic for the "help" button.

helpButtonText

protected String helpButtonText
The localised text for the "help" button.

helpButtonToolTipText

protected String helpButtonToolTipText
The localised tool tip text for the help button.

homeFolderIcon

protected Icon homeFolderIcon
An icon representing the user's home folder.

listViewIcon

protected Icon listViewIcon
An icon for the "list view" button.

newFolderIcon

protected Icon newFolderIcon
An icon for the "new folder" button.

openButtonMnemonic

protected int openButtonMnemonic
The localised mnemonic for the "open" button.

openButtonText

protected String openButtonText
The localised text for the "open" button.

openButtonToolTipText

protected String openButtonToolTipText
The localised tool tip text for the "open" button.

saveButtonMnemonic

protected int saveButtonMnemonic
The localised mnemonic for the "save" button.

saveButtonText

protected String saveButtonText
The localised text for the "save" button.

saveButtonToolTipText

protected String saveButtonToolTipText
The localised tool tip text for the save button.

updateButtonMnemonic

protected int updateButtonMnemonic
The localised mnemonic for the "update" button.

updateButtonText

protected String updateButtonText
The localised text for the "update" button.

updateButtonToolTipText

protected String updateButtonToolTipText
The localised tool tip text for the "update" button.

upFolderIcon

protected Icon upFolderIcon
An icon for the "up folder" button.

Constructor Detail

BasicFileChooserUI

public BasicFileChooserUI(JFileChooser b)
Creates a new BasicFileChooserUI object.

Parameters: b the file chooser component.

Method Detail

clearIconCache

public void clearIconCache()
Clears the icon cache.

createDoubleClickListener

protected MouseListener createDoubleClickListener(JFileChooser fc, JList list)
Creates a new listener to handle double-click events.

Parameters: fc the file chooser component. list the list.

Returns: A new instance of {@link DoubleClickListener}.

createListSelectionListener

public ListSelectionListener createListSelectionListener(JFileChooser fc)
Creates a new listener to handle selections in the file list.

Parameters: fc the file chooser component.

Returns: A new instance of {@link SelectionListener}.

createModel

protected void createModel()
Creates a new directory model.

createPropertyChangeListener

public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
Creates a listener to handle changes to the properties of the given file chooser component.

Parameters: fc the file chooser component.

Returns: A new listener.

createUI

public static ComponentUI createUI(JComponent c)
Returns a UI delegate for the given component.

Parameters: c the component (should be a {@link JFileChooser}).

Returns: A new UI delegate.

ensureFileIsVisible

public void ensureFileIsVisible(JFileChooser fc, File f)
NOT YET IMPLEMENTED.

Parameters: fc the file chooser. f the file.

getAcceptAllFileFilter

public FileFilter getAcceptAllFileFilter(JFileChooser fc)
Returns the "accept all" file filter.

Parameters: fc the file chooser component.

Returns: The "accept all" file filter.

getAccessoryPanel

public JPanel getAccessoryPanel()
Returns the optional accessory panel.

Returns: The optional accessory panel.

getApproveButton

protected JButton getApproveButton(JFileChooser fc)
Returns the approve (open or save) button for the dialog.

Parameters: fc the file chooser.

Returns: The button.

getApproveButtonMnemonic

public int getApproveButtonMnemonic(JFileChooser fc)
Returns the approve button mnemonic.

Parameters: fc the file chooser (null not permitted).

Returns: The approve button mnemonic.

See Also: getApproveButtonMnemonic

getApproveButtonText

public String getApproveButtonText(JFileChooser fc)
Returns the approve button text.

Parameters: fc the file chooser (null not permitted).

Returns: The approve button text.

See Also: getApproveButtonText

getApproveButtonToolTipText

public String getApproveButtonToolTipText(JFileChooser fc)
Returns the tool tip text for the approve (open/save) button. This first checks the file chooser to see if a value has been explicitly set - if not, a default value appropriate for the type of file chooser is returned.

Parameters: fc the file chooser.

Returns: The tool tip text.

getApproveSelectionAction

public Action getApproveSelectionAction()
Returns the action that handles events for the "approve" button.

Returns: An instance of {@link ApproveSelectionAction}.

getCancelSelectionAction

public Action getCancelSelectionAction()
Returns the action that handles events for the "cancel" button.

Returns: An instance of {@link CancelSelectionAction}.

getChangeToParentDirectoryAction

public Action getChangeToParentDirectoryAction()
Returns the action that handles events for the "up folder" control button.

Returns: An instance of {@link ChangeToParentDirectoryAction}.

getDialogTitle

public String getDialogTitle(JFileChooser fc)
Returns the dialog title.

Parameters: fc the file chooser (null not permitted).

Returns: The dialog title.

See Also: getDialogTitle

getDirectory

protected File getDirectory()
Returns the current directory.

Returns: The current directory.

getDirectoryName

public String getDirectoryName()
Returns the current directory name.

Returns: The directory name.

See Also: setDirectoryName

getFileChooser

public JFileChooser getFileChooser()
Returns the {@link JFileChooser} component that this UI delegate represents.

Returns: The component represented by this UI delegate.

getFileName

public String getFileName()
Returns the current file name.

Returns: The current file name.

getFileView

public FileView getFileView(JFileChooser fc)
Returns the default file view (NOT the file view from the file chooser, if there is one).

Parameters: fc the file chooser component.

Returns: The file view.

See Also: getFileView

getGoHomeAction

public Action getGoHomeAction()
Creates and returns a new action that will be used with the "home folder" button.

Returns: A new instance of {@link GoHomeAction}.

getModel

public BasicDirectoryModel getModel()
Returns the directory model.

Returns: The directory model.

getNewFolderAction

public Action getNewFolderAction()
Creates and returns a new action that will be used with the "new folder" button.

Returns: A new instance of {@link NewFolderAction}.

getUpdateAction

public Action getUpdateAction()
Returns the update action (an instance of {@link UpdateAction}).

Returns: An action.

installComponents

public void installComponents(JFileChooser fc)
Creates and install the subcomponents for the file chooser.

Parameters: fc the file chooser.

installDefaults

protected void installDefaults(JFileChooser fc)
Installs the defaults for this UI delegate.

Parameters: fc the file chooser.

installIcons

protected void installIcons(JFileChooser fc)
Installs the icons for this UI delegate.

Parameters: fc the file chooser (ignored).

installListeners

protected void installListeners(JFileChooser fc)
Installs the listeners required by this UI delegate.

Parameters: fc the file chooser.

installStrings

protected void installStrings(JFileChooser fc)
Installs the strings used by this UI delegate.

Parameters: fc the file chooser.

installUI

public void installUI(JComponent c)
Installs the UI for the specified component.

Parameters: c the component (should be a {@link JFileChooser}).

isDirectorySelected

protected boolean isDirectorySelected()
Returns true if a directory is selected, and false otherwise.

Returns: A boolean.

rescanCurrentDirectory

public void rescanCurrentDirectory(JFileChooser fc)
Rescans the current directory.

Parameters: fc the file chooser.

setDirectory

protected void setDirectory(File f)
Sets the current directory.

Parameters: f the directory.

setDirectoryName

public void setDirectoryName(String dirname)
Sets the directory name (NOT IMPLEMENTED).

Parameters: dirname the directory name.

See Also: getDirectoryName

setDirectorySelected

protected void setDirectorySelected(boolean selected)
Sets the flag that indicates whether the current directory is selected.

Parameters: selected the new flag value.

setFileName

public void setFileName(String filename)
Sets the file name.

Parameters: filename the file name.

See Also: getFileName

uninstallComponents

public void uninstallComponents(JFileChooser fc)
Uninstalls the components from the file chooser.

Parameters: fc the file chooser.

uninstallDefaults

protected void uninstallDefaults(JFileChooser fc)
Uninstalls the defaults previously added by this UI delegate.

Parameters: fc the file chooser.

uninstallIcons

protected void uninstallIcons(JFileChooser fc)
Uninstalls the icons previously added by this UI delegate.

Parameters: fc the file chooser.

uninstallListeners

protected void uninstallListeners(JFileChooser fc)
Uninstalls the listeners previously installed by this UI delegate.

Parameters: fc the file chooser.

uninstallStrings

protected void uninstallStrings(JFileChooser fc)
Uninstalls the strings previously added by this UI delegate.

Parameters: fc the file chooser.

uninstallUI

public void uninstallUI(JComponent c)
Uninstalls this UI from the given component.

Parameters: c the component (should be a {@link JFileChooser}).