使用JFileChooser吧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
See Also:
getFileSelectionMode()
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
See Also:
getFileSelectionMode()
解决方案 »
- 一个java的小问题!
- 能够给简略的介绍一下static在java中到底起什么作用?怎么用呢?
- 找某集合中任意元素之和最接近于一指定值的所有的元素的算法
- 如何获得前一天的日期,或者前任意天的日期
- 求助!!!关于jsp运行环境的问题。
- Java3D Behavior问题
- 一个很长的字符串,随意改动n处得到另一个字符串。用什么方法能知道改动了什么内容??
- 测试一下ObjectInputStream类 不成功阿
- JAVA(JSP)开发困惑-为什么我对jsp看不到希望
- 哪个JAVA工具好
- 如何像Exception.printStackTrace()一样获得调用方法的trace
- 基于BS方式的生成数字证书怎么做啊,我一点概念都没有,不知道是要做成什么样子的。请指点一下
它会一直打开到最底层的目录。大家在给我点意见吧。