Java javax.swing JFileChooser fields, constructors, methods, implement or subclass

Example usage for Java javax.swing JFileChooser fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing JFileChooser.

The text is from its open source code.

Subclass

javax.swing.JFileChooser has subclasses.
Click this link to see all its subclasses.

Field

intOPEN_DIALOG
Type value indicating that the JFileChooser supports an "Open" file operation.
intSAVE_DIALOG
Type value indicating that the JFileChooser supports a "Save" file operation.
intCUSTOM_DIALOG
Type value indicating that the JFileChooser supports a developer-specified file operation.
intCANCEL_OPTION
Return value if cancel is chosen.
intAPPROVE_OPTION
Return value if approve (yes, ok) is chosen.
intERROR_OPTION
Return value if an error occurred.
intFILES_ONLY
Instruction to display only files.
intDIRECTORIES_ONLY
Instruction to display only directories.
intFILES_AND_DIRECTORIES
Instruction to display both files and directories.
StringCANCEL_SELECTION
Instruction to cancel the current selection.
StringAPPROVE_SELECTION
Instruction to approve the current selection (same as pressing yes or ok).
StringAPPROVE_BUTTON_TEXT_CHANGED_PROPERTY
Identifies change in the text on the approve (yes, ok) button.
StringAPPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY
Identifies change in the tooltip text for the approve (yes, ok) button.
StringAPPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY
Identifies change in the mnemonic for the approve (yes, ok) button.
StringCONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY
Instruction to display the control buttons.
StringDIRECTORY_CHANGED_PROPERTY
Identifies user's directory change.
StringSELECTED_FILE_CHANGED_PROPERTY
Identifies change in user's single-file selection.
StringSELECTED_FILES_CHANGED_PROPERTY
Identifies change in user's multiple-file selection.
StringMULTI_SELECTION_ENABLED_CHANGED_PROPERTY
Enables multiple-file selections.
StringFILE_SYSTEM_VIEW_CHANGED_PROPERTY
Says that a different object is being used to find available drives on the system.
StringFILE_VIEW_CHANGED_PROPERTY
Says that a different object is being used to retrieve file information.
StringFILE_HIDING_CHANGED_PROPERTY
Identifies a change in the display-hidden-files property.
StringFILE_FILTER_CHANGED_PROPERTY
User changed the kind of files to display.
StringFILE_SELECTION_MODE_CHANGED_PROPERTY
Identifies a change in the kind of selection (single, multiple, etc.).
StringACCESSORY_CHANGED_PROPERTY
Says that a different accessory component is in use (for example, to preview files).
StringACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY
Identifies whether a the AcceptAllFileFilter is used or not.
StringDIALOG_TITLE_CHANGED_PROPERTY
Identifies a change in the dialog title.
StringDIALOG_TYPE_CHANGED_PROPERTY
Identifies a change in the type of files displayed (files only, directories only, or both files and directories).
StringCHOOSABLE_FILE_FILTER_CHANGED_PROPERTY
Identifies a change in the list of predefined file filters the user can choose from.

Constructor

JFileChooser()
Constructs a JFileChooser pointing to the user's default directory.
JFileChooser(String currentDirectoryPath)
Constructs a JFileChooser using the given path.
JFileChooser(File currentDirectory)
Constructs a JFileChooser using the given File as the path.
JFileChooser(FileSystemView fsv)
Constructs a JFileChooser using the given FileSystemView.

Method

voidaddActionListener(ActionListener l)
Adds an ActionListener to the file chooser.
voidaddChoosableFileFilter(FileFilter filter)
Adds a filter to the list of user choosable file filters.
voidaddComponentListener(ComponentListener l)
Adds the specified component listener to receive component events from this component.
voidaddPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.
voidensureFileIsVisible(File f)
Makes sure that the specified file is viewable, and not hidden.
FileFiltergetAcceptAllFileFilter()
Returns the AcceptAll file filter.
AccessibleContextgetAccessibleContext()
Gets the AccessibleContext associated with this JFileChooser.
JComponentgetAccessory()
Returns the accessory component.
ActionListener[]getActionListeners()
Returns an array of all the action listeners registered on this file chooser.
ActionMapgetActionMap()
Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding.
intgetApproveButtonMnemonic()
Returns the approve button's mnemonic.
StringgetApproveButtonText()
Returns the text used in the ApproveButton in the FileChooserUI.
StringgetApproveButtonToolTipText()
Returns the tooltip text used in the ApproveButton.
FileFilter[]getChoosableFileFilters()
Gets the list of user choosable file filters.
ComponentgetComponent(int n)
Gets the nth component in this container.
Component[]getComponents()
Gets all the components in this container.
booleangetControlButtonsAreShown()
Returns the value of the controlButtonsAreShown property.
FilegetCurrentDirectory()
Returns the current directory.
StringgetDescription(File f)
Returns the file description.
StringgetDialogTitle()
Gets the string that goes in the JFileChooser's titlebar.
intgetDialogType()
Returns the type of this dialog.
booleangetDragEnabled()
Gets the value of the dragEnabled property.
FileFiltergetFileFilter()
Returns the currently selected file filter.
intgetFileSelectionMode()
Returns the current file-selection mode.
FileSystemViewgetFileSystemView()
Returns the file system view.
FileViewgetFileView()
Returns the current file view.
IcongetIcon(File f)
Returns the icon for this file or type of file, depending on the system.
StringgetName(File f)
Returns the filename.
DimensiongetPreferredSize()
If the preferredSize has been set to a non-null value just returns it.
FilegetSelectedFile()
Returns the selected file.
File[]getSelectedFiles()
Returns a list of selected files if the file chooser is set to allow multiple selection.
StringgetTypeDescription(File f)
Returns the file type.
FileChooserUIgetUI()
Gets the UI object which implements the L&F for this component.
booleanisAcceptAllFileFilterUsed()
Returns whether the AcceptAll FileFilter is used.
booleanisDirectorySelectionEnabled()
Convenience call that determines if directories are selectable based on the current file selection mode.
booleanisFileHidingEnabled()
Returns true if hidden files are not shown in the file chooser; otherwise, returns false.
booleanisFileSelectionEnabled()
Convenience call that determines if files are selectable based on the current file selection mode.
booleanisMultiSelectionEnabled()
Returns true if multiple files can be selected.
booleanisTraversable(File f)
Returns true if the file (directory) can be visited.
voidputClientProperty(Object key, Object value)
Adds an arbitrary key/value "client property" to this component.
voidremoveActionListener(ActionListener l)
Removes an ActionListener from the file chooser.
voidremoveAll()
Removes all the components from this container.
booleanremoveChoosableFileFilter(FileFilter f)
Removes a filter from the list of user choosable file filters.
voidrepaint()
Repaints this component.
voidrequestFocus()
Requests that this Component gets the input focus.
voidrescanCurrentDirectory()
Tells the UI to rescan its files list from the current directory.
voidresetChoosableFileFilters()
Resets the choosable file filter list to its starting state.
voidsetAcceptAllFileFilterUsed(boolean b)
Determines whether the AcceptAll FileFilter is used as an available choice in the choosable filter list.
voidsetAccessory(JComponent newAccessory)
Sets the accessory component.
voidsetApproveButtonMnemonic(int mnemonic)
Sets the approve button's mnemonic using a numeric keycode.
voidsetApproveButtonMnemonic(char mnemonic)
Sets the approve button's mnemonic using a character.
voidsetApproveButtonText(String approveButtonText)
Sets the text used in the ApproveButton in the FileChooserUI.
voidsetApproveButtonToolTipText(String toolTipText)
Sets the tooltip text used in the ApproveButton.
voidsetBackground(Color bg)
Sets the background color of this component.
voidsetBounds(int x, int y, int width, int height)
Moves and resizes this component.
voidsetControlButtonsAreShown(boolean b)
Sets the property that indicates whether the approve and cancel buttons are shown in the file chooser.
voidsetCurrentDirectory(File dir)
Sets the current directory.
voidsetDialogTitle(String dialogTitle)
Sets the string that goes in the JFileChooser window's title bar.
voidsetDialogType(int dialogType)
Sets the type of this dialog.
voidsetDragEnabled(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.
voidsetFileFilter(FileFilter filter)
Sets the current file filter.
voidsetFileHidingEnabled(boolean b)
Sets file hiding on or off.
voidsetFileSelectionMode(int mode)
Sets the JFileChooser to allow the user to just select files, just select directories, or select both files and directories.
voidsetFileSystemView(FileSystemView 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.
voidsetFileView(FileView fileView)
Sets the file view to be used to retrieve UI information, such as the icon that represents a file or the type description of a file.
voidsetLocale(Locale l)
Sets the locale of this component.
voidsetLocation(int x, int y)
Moves this component to a new location.
voidsetMultiSelectionEnabled(boolean b)
Sets the file chooser to allow multiple file selections.
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component.
voidsetSelectedFile(File file)
Sets the selected file.
voidsetSelectedFiles(File[] selectedFiles)
Sets the list of selected files if the file chooser is set to allow multiple selection.
voidsetToolTipText(String text)
Registers the text to display in a tool tip.
voidsetVisible(boolean aFlag)
Makes the component visible or invisible.
intshowDialog(Component parent, String approveButtonText)
Pops a custom file chooser dialog with a custom approve button.
intshowOpenDialog(Component parent)
Pops up an "Open File" file chooser dialog.
intshowSaveDialog(Component parent)
Pops up a "Save File" file chooser dialog.
voidupdateUI()
Resets the UI property to a value from the current look and feel.