可以的 setFileSelectionMode public void setFileSelectionMode(int mode) Sets the JFileChooser to allow the user to just select files, just select directories, or select both files and directories. The default is JFilesChooser.FILES_ONLY. Parameters: mode - the type of files to be displayed: JFileChooser.FILES_ONLY JFileChooser.DIRECTORIES_ONLY JFileChooser.FILES_AND_DIRECTORIES Throws: IllegalArgumentException - if mode is an illegal file selection mode See Also: getFileSelectionMode()
setFileSelectionMode
public void setFileSelectionMode(int mode)
Sets the JFileChooser to allow the user to just select files, just select directories, or select both files and directories. The default is JFilesChooser.FILES_ONLY. Parameters:
mode - the type of files to be displayed:
JFileChooser.FILES_ONLY
JFileChooser.DIRECTORIES_ONLY
JFileChooser.FILES_AND_DIRECTORIES
Throws:
IllegalArgumentException - if mode is an illegal file selection mode
See Also:
getFileSelectionMode()