JFileChooser (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
boolean
[accept](../../javax/swing/JFileChooser.html#accept-java.io.File-)([File](../../java/io/File.html "class in java.io") f)
Returns true if the file should be displayed.
void
[addActionListener](../../javax/swing/JFileChooser.html#addActionListener-java.awt.event.ActionListener-)([ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event") l)
Adds an ActionListener
to the file chooser.
void
[addChoosableFileFilter](../../javax/swing/JFileChooser.html#addChoosableFileFilter-javax.swing.filechooser.FileFilter-)([FileFilter](../../javax/swing/filechooser/FileFilter.html "class in javax.swing.filechooser") filter)
Adds a filter to the list of user choosable file filters.
void
[approveSelection](../../javax/swing/JFileChooser.html#approveSelection--)()
Called by the UI when the user hits the Approve button (labeled "Open" or "Save", by default).
void
[cancelSelection](../../javax/swing/JFileChooser.html#cancelSelection--)()
Called by the UI when the user chooses the Cancel button.
void
[changeToParentDirectory](../../javax/swing/JFileChooser.html#changeToParentDirectory--)()
Changes the directory to be set to the parent of the current directory.
protected [JDialog](../../javax/swing/JDialog.html "class in javax.swing")
[createDialog](../../javax/swing/JFileChooser.html#createDialog-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") parent)
Creates and returns a new JDialog
wrappingthis
centered on the parent
in the parent
's frame.
void
[ensureFileIsVisible](../../javax/swing/JFileChooser.html#ensureFileIsVisible-java.io.File-)([File](../../java/io/File.html "class in java.io") f)
Makes sure that the specified file is viewable, and not hidden.
protected void
[fireActionPerformed](../../javax/swing/JFileChooser.html#fireActionPerformed-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") command)
Notifies all listeners that have registered interest for notification on this event type.
[FileFilter](../../javax/swing/filechooser/FileFilter.html "class in javax.swing.filechooser")
[getAcceptAllFileFilter](../../javax/swing/JFileChooser.html#getAcceptAllFileFilter--)()
Returns the AcceptAll
file filter.
[AccessibleContext](../../javax/accessibility/AccessibleContext.html "class in javax.accessibility")
[getAccessibleContext](../../javax/swing/JFileChooser.html#getAccessibleContext--)()
Gets the AccessibleContext associated with this JFileChooser.
[JComponent](../../javax/swing/JComponent.html "class in javax.swing")
[getAccessory](../../javax/swing/JFileChooser.html#getAccessory--)()
Returns the accessory component.
[ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event")[]
[getActionListeners](../../javax/swing/JFileChooser.html#getActionListeners--)()
Returns an array of all the action listeners registered on this file chooser.
int
[getApproveButtonMnemonic](../../javax/swing/JFileChooser.html#getApproveButtonMnemonic--)()
Returns the approve button's mnemonic.
[String](../../java/lang/String.html "class in java.lang")
[getApproveButtonText](../../javax/swing/JFileChooser.html#getApproveButtonText--)()
Returns the text used in the ApproveButton
in theFileChooserUI
.
[String](../../java/lang/String.html "class in java.lang")
[getApproveButtonToolTipText](../../javax/swing/JFileChooser.html#getApproveButtonToolTipText--)()
Returns the tooltip text used in the ApproveButton
.
[FileFilter](../../javax/swing/filechooser/FileFilter.html "class in javax.swing.filechooser")[]
[getChoosableFileFilters](../../javax/swing/JFileChooser.html#getChoosableFileFilters--)()
Gets the list of user choosable file filters.
boolean
[getControlButtonsAreShown](../../javax/swing/JFileChooser.html#getControlButtonsAreShown--)()
Returns the value of the controlButtonsAreShown
property.
[File](../../java/io/File.html "class in java.io")
[getCurrentDirectory](../../javax/swing/JFileChooser.html#getCurrentDirectory--)()
Returns the current directory.
[String](../../java/lang/String.html "class in java.lang")
[getDescription](../../javax/swing/JFileChooser.html#getDescription-java.io.File-)([File](../../java/io/File.html "class in java.io") f)
Returns the file description.
[String](../../java/lang/String.html "class in java.lang")
[getDialogTitle](../../javax/swing/JFileChooser.html#getDialogTitle--)()
Gets the string that goes in the JFileChooser
's titlebar.
int
[getDialogType](../../javax/swing/JFileChooser.html#getDialogType--)()
Returns the type of this dialog.
boolean
[getDragEnabled](../../javax/swing/JFileChooser.html#getDragEnabled--)()
Gets the value of the dragEnabled
property.
[FileFilter](../../javax/swing/filechooser/FileFilter.html "class in javax.swing.filechooser")
[getFileFilter](../../javax/swing/JFileChooser.html#getFileFilter--)()
Returns the currently selected file filter.
int
[getFileSelectionMode](../../javax/swing/JFileChooser.html#getFileSelectionMode--)()
Returns the current file-selection mode.
[FileSystemView](../../javax/swing/filechooser/FileSystemView.html "class in javax.swing.filechooser")
[getFileSystemView](../../javax/swing/JFileChooser.html#getFileSystemView--)()
Returns the file system view.
[FileView](../../javax/swing/filechooser/FileView.html "class in javax.swing.filechooser")
[getFileView](../../javax/swing/JFileChooser.html#getFileView--)()
Returns the current file view.
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getIcon](../../javax/swing/JFileChooser.html#getIcon-java.io.File-)([File](../../java/io/File.html "class in java.io") f)
Returns the icon for this file or type of file, depending on the system.
[String](../../java/lang/String.html "class in java.lang")
[getName](../../javax/swing/JFileChooser.html#getName-java.io.File-)([File](../../java/io/File.html "class in java.io") f)
Returns the filename.
[File](../../java/io/File.html "class in java.io")
[getSelectedFile](../../javax/swing/JFileChooser.html#getSelectedFile--)()
Returns the selected file.
[File](../../java/io/File.html "class in java.io")[]
[getSelectedFiles](../../javax/swing/JFileChooser.html#getSelectedFiles--)()
Returns a list of selected files if the file chooser is set to allow multiple selection.
[String](../../java/lang/String.html "class in java.lang")
[getTypeDescription](../../javax/swing/JFileChooser.html#getTypeDescription-java.io.File-)([File](../../java/io/File.html "class in java.io") f)
Returns the file type.
[FileChooserUI](../../javax/swing/plaf/FileChooserUI.html "class in javax.swing.plaf")
[getUI](../../javax/swing/JFileChooser.html#getUI--)()
Gets the UI object which implements the L&F for this component.
[String](../../java/lang/String.html "class in java.lang")
[getUIClassID](../../javax/swing/JFileChooser.html#getUIClassID--)()
Returns a string that specifies the name of the L&F class that renders this component.
boolean
[isAcceptAllFileFilterUsed](../../javax/swing/JFileChooser.html#isAcceptAllFileFilterUsed--)()
Returns whether the AcceptAll FileFilter
is used.
boolean
[isDirectorySelectionEnabled](../../javax/swing/JFileChooser.html#isDirectorySelectionEnabled--)()
Convenience call that determines if directories are selectable based on the current file selection mode.
boolean
[isFileHidingEnabled](../../javax/swing/JFileChooser.html#isFileHidingEnabled--)()
Returns true if hidden files are not shown in the file chooser; otherwise, returns false.
boolean
[isFileSelectionEnabled](../../javax/swing/JFileChooser.html#isFileSelectionEnabled--)()
Convenience call that determines if files are selectable based on the current file selection mode.
boolean
[isMultiSelectionEnabled](../../javax/swing/JFileChooser.html#isMultiSelectionEnabled--)()
Returns true if multiple files can be selected.
boolean
[isTraversable](../../javax/swing/JFileChooser.html#isTraversable-java.io.File-)([File](../../java/io/File.html "class in java.io") f)
Returns true if the file (directory) can be visited.
protected [String](../../java/lang/String.html "class in java.lang")
[paramString](../../javax/swing/JFileChooser.html#paramString--)()
Returns a string representation of this JFileChooser
.
void
[removeActionListener](../../javax/swing/JFileChooser.html#removeActionListener-java.awt.event.ActionListener-)([ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event") l)
Removes an ActionListener
from the file chooser.
boolean
[removeChoosableFileFilter](../../javax/swing/JFileChooser.html#removeChoosableFileFilter-javax.swing.filechooser.FileFilter-)([FileFilter](../../javax/swing/filechooser/FileFilter.html "class in javax.swing.filechooser") f)
Removes a filter from the list of user choosable file filters.
void
[rescanCurrentDirectory](../../javax/swing/JFileChooser.html#rescanCurrentDirectory--)()
Tells the UI to rescan its files list from the current directory.
void
[resetChoosableFileFilters](../../javax/swing/JFileChooser.html#resetChoosableFileFilters--)()
Resets the choosable file filter list to its starting state.
void
[setAcceptAllFileFilterUsed](../../javax/swing/JFileChooser.html#setAcceptAllFileFilterUsed-boolean-)(boolean b)
Determines whether the AcceptAll FileFilter
is used as an available choice in the choosable filter list.
void
[setAccessory](../../javax/swing/JFileChooser.html#setAccessory-javax.swing.JComponent-)([JComponent](../../javax/swing/JComponent.html "class in javax.swing") newAccessory)
Sets the accessory component.
void
[setApproveButtonMnemonic](../../javax/swing/JFileChooser.html#setApproveButtonMnemonic-char-)(char mnemonic)
Sets the approve button's mnemonic using a character.
void
[setApproveButtonMnemonic](../../javax/swing/JFileChooser.html#setApproveButtonMnemonic-int-)(int mnemonic)
Sets the approve button's mnemonic using a numeric keycode.
void
[setApproveButtonText](../../javax/swing/JFileChooser.html#setApproveButtonText-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") approveButtonText)
Sets the text used in the ApproveButton
in theFileChooserUI
.
void
[setApproveButtonToolTipText](../../javax/swing/JFileChooser.html#setApproveButtonToolTipText-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") toolTipText)
Sets the tooltip text used in the ApproveButton
.
void
[setControlButtonsAreShown](../../javax/swing/JFileChooser.html#setControlButtonsAreShown-boolean-)(boolean b)
Sets the property that indicates whether the approve and cancel buttons are shown in the file chooser.
void
[setCurrentDirectory](../../javax/swing/JFileChooser.html#setCurrentDirectory-java.io.File-)([File](../../java/io/File.html "class in java.io") dir)
Sets the current directory.
void
[setDialogTitle](../../javax/swing/JFileChooser.html#setDialogTitle-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") dialogTitle)
Sets the string that goes in the JFileChooser
window's title bar.
void
[setDialogType](../../javax/swing/JFileChooser.html#setDialogType-int-)(int dialogType)
Sets the type of this dialog.
void
[setDragEnabled](../../javax/swing/JFileChooser.html#setDragEnabled-boolean-)(boolean b)
Sets the dragEnabled
property, which must be true
to enable automatic drag handling (the first part of drag and drop) on this component.
void
[setFileFilter](../../javax/swing/JFileChooser.html#setFileFilter-javax.swing.filechooser.FileFilter-)([FileFilter](../../javax/swing/filechooser/FileFilter.html "class in javax.swing.filechooser") filter)
Sets the current file filter.
void
[setFileHidingEnabled](../../javax/swing/JFileChooser.html#setFileHidingEnabled-boolean-)(boolean b)
Sets file hiding on or off.
void
[setFileSelectionMode](../../javax/swing/JFileChooser.html#setFileSelectionMode-int-)(int mode)
Sets the JFileChooser
to allow the user to just select files, just select directories, or select both files and directories.
void
[setFileSystemView](../../javax/swing/JFileChooser.html#setFileSystemView-javax.swing.filechooser.FileSystemView-)([FileSystemView](../../javax/swing/filechooser/FileSystemView.html "class in javax.swing.filechooser") fsv)
Sets the file system view that the JFileChooser
uses for accessing and creating file system resources, such as finding the floppy drive and getting a list of root drives.
void
[setFileView](../../javax/swing/JFileChooser.html#setFileView-javax.swing.filechooser.FileView-)([FileView](../../javax/swing/filechooser/FileView.html "class in javax.swing.filechooser") fileView)
Sets the file view to used to retrieve UI information, such as the icon that represents a file or the type description of a file.
void
[setMultiSelectionEnabled](../../javax/swing/JFileChooser.html#setMultiSelectionEnabled-boolean-)(boolean b)
Sets the file chooser to allow multiple file selections.
void
[setSelectedFile](../../javax/swing/JFileChooser.html#setSelectedFile-java.io.File-)([File](../../java/io/File.html "class in java.io") file)
Sets the selected file.
void
[setSelectedFiles](../../javax/swing/JFileChooser.html#setSelectedFiles-java.io.File:A-)([File](../../java/io/File.html "class in java.io")[] selectedFiles)
Sets the list of selected files if the file chooser is set to allow multiple selection.
protected void
[setup](../../javax/swing/JFileChooser.html#setup-javax.swing.filechooser.FileSystemView-)([FileSystemView](../../javax/swing/filechooser/FileSystemView.html "class in javax.swing.filechooser") view)
Performs common constructor initialization and setup.
int
[showDialog](../../javax/swing/JFileChooser.html#showDialog-java.awt.Component-java.lang.String-)([Component](../../java/awt/Component.html "class in java.awt") parent,[String](../../java/lang/String.html "class in java.lang") approveButtonText)
Pops a custom file chooser dialog with a custom approve button.
int
[showOpenDialog](../../javax/swing/JFileChooser.html#showOpenDialog-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") parent)
Pops up an "Open File" file chooser dialog.
int
[showSaveDialog](../../javax/swing/JFileChooser.html#showSaveDialog-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") parent)
Pops up a "Save File" file chooser dialog.
void
[updateUI](../../javax/swing/JFileChooser.html#updateUI--)()
Resets the UI property to a value from the current look and feel.