简体   繁体   English

如何在Javafx2中选择多个文件夹和文件?

[英]How to select multiple folders and files in Javafx2?

I am working on javafx 2. but there is no feature of multiple folders and files available on the filechooser . 我正在研究javafx 2.但是filechooser上没有多个文件夹和文件的filechooser

There is the Directory chooser but it selects only one folder. Directory chooser但它只选择一个文件夹。 How can i solve this problem. 我怎么解决这个问题。 Please give me any suggestion? 请给我任何建议?

JavaFX supports single and multiple file dialogs: JavaFX支持单个和多个文件对话框:

http://docs.oracle.com/javafx/2/api/javafx/stage/FileChooser.html http://docs.oracle.com/javafx/2/api/javafx/stage/FileChooser.html

and single directory dialog: 和单目录对话框:

http://docs.oracle.com/javafx/2/api/javafx/stage/DirectoryChooser.html http://docs.oracle.com/javafx/2/api/javafx/stage/DirectoryChooser.html

There was a special RFE for this : https://bugs.openjdk.java.net/browse/JDK-8101526 . 有一个特殊的RFE: https//bugs.openjdk.java.net/browse/JDK-8101526

There is a special RFE for multiple directories chosign, you can wait, until it will be fixed : https://bugs.openjdk.java.net/browse/JDK-8091403 , also, you can vote it up, for it to be fixed with higher priority 有一个特殊的RFE用于多个目录chosign,你可以等待,直到它将被修复: https ://bugs.openjdk.java.net/browse/JDK-8091403,你也可以投票,因为它是以更高优先级固定

We can use JFileChooer of Swing component. 我们可以使用Swing组件的JFileChooer。 But then its give error like Headless something. 但后来它给出了像无头的东西的错误。 So remove this error by following steps. 因此,请按照以下步骤删除此错误。

1) Initialised all component of swing before javafx. 1)在javafx之前初始化swing的所有组件。 2) use System.setProperty and set Headless false . 2)使用System.setProperty并设置Headless false。

Then jfilechooser works. 然后jfilechooser工作。 Thanks to all. 谢谢大家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM