[英](Java) FileChooser only allow specific file?
How is it possible to allow the user only to open a specific file? 怎么可能只允许用户打开特定文件?
In my case I want only to allow to open the "myapplication.exe"
file, which could be somewhere on my filesystem, so this is why I need the FileChooser
. 就我而言,我只希望打开
"myapplication.exe"
文件,该文件可能位于我的文件系统上,因此这就是为什么我需要FileChooser
。
I only know how to allow specific file extensions. 我只知道如何允许特定的文件扩展名。 I could only allow them to open all
*.exe
files, but this is too much; 我只能允许他们打开所有
*.exe
文件,但这太过分了。 I only want to allow this one specific file. 我只想允许这个特定文件。
I searched so much, but did not find a solution to this. 我进行了很多搜索,但没有找到解决方案。 I hope you could help me.
我希望你能帮助我。
Is this possible? 这可能吗? If yes, how?
如果是,怎么办?
您可以将FileFilter的任何实现设置为文件选择器,它不必是FileNameExtensionFilter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.