gpt4 book ai didi

java - 如何在 JFileChooser 中仅列出硬盘驱动器?

转载 作者:太空宇宙 更新时间:2023-11-04 07:16:03 24 4
gpt4 key购买 nike

有没有办法在 JFileChooser 中仅列出根驱动器?我的意思是我需要防止在 JFilechooser 中列出光盘驱动器/可移动驱动器。我正在使用 java6。

提前致谢

更新

或者知道所选文件来自 CD/DVD 驱动器就可以了...可以以独立于平台的方式吗?

谢谢

最佳答案

By default, a file chooser displays all of the files and directories that it detects, except for hidden files. A program can apply one or more file filters to a file chooser so that the chooser shows only some files. The file chooser calls the filter's accept method for each file to determine whether it should be displayed. A file filter accepts or rejects a file based on criteria such as file type, size, ownership, and so on. Filters affect the list of files displayed by the file chooser. The user can enter the name of any file even if it is not displayed.

这里是链接How to Use File Choosers

关于java - 如何在 JFileChooser 中仅列出硬盘驱动器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19969387/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com