当前位置: 技术问答>java相关
请教大家一个问题,有没有一个类既可选择目录又可选文件,jFileChooser只能选文件。
来源: 互联网 发布时间:2015-03-09
本文导语: | 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 - th...
|
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 Dialog mode
JFileChooser是可以即选文件又选目录的,用这个方法就行了。多看看API文档吧
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 Dialog mode
JFileChooser是可以即选文件又选目录的,用这个方法就行了。多看看API文档吧