java - JFileChooser网络显示

标签 java swing jfilechooser

我需要安全地锁定 Windows 上的 Java 桌面应用程序,以便只能访问允许的驱动器。

如何阻止应用程序上的 JFilechooser 显示和浏览本地网络?

我已尝试应用安全策略,但这似乎不会影响显示。

最佳答案

使用JFileChooser.setFileSystemView(FileSystemView)FileSystemView ..

..is JFileChooser's gateway to the file system. Since the JDK1.1 File API doesn't allow access to such information as root partitions, file type information, or hidden file bits, this class is designed to intuit as much OS-specific file system information as possible. Java Licensees may want to provide a different implementation of FileSystemView to better handle a given operating system.

重要的部分是改变 isTraversable(File) 的行为方法。

关于java - JFileChooser网络显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31166150/

相关文章:

java - 在 JFrame 中格式化结果

Java Swing - 将 JLabel 中的图像放置到/高于第二个 JLabel( map 、播放器指示器)

java - 使用 JFileChooser 打开文件

java - UCanAccess 与 JFileChooser : "Empty database file"

java - 带有 JFileChooser UI (?) 的 OS X 中的错误

java - 如何在 hibernate 中将条件结果对象插入数据库

java - JToolBar 中的 JSeperator 将组件移动到右端

java - GAE/J 范围查询中最大可能的键字符串是什么?

java - Kotlin CDI 拦截器未被调用

java - 按 ID 和名字对员工详细信息进行排序的集合