How to select multiple folders and files in Javafx2?

I am working on javafx 2.

but there is no multiple folders and files feature available on filechooser

.

There is Directory chooser

, but it only selects one folder. How can I solve this problem. Please give me any suggestion?

+3


source to share


2 answers


We can use the JFileChooer of the Swing component. But then it gives an error like something like Headless. So remove this error by following the steps below.

1) Initialized all swing component before javafx. 2) use System.setProperty and set Headless to false.



Then jfilechooser works. Thanks everyone.

+2


source


JavaFX supports one or more file dialogs:

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

and a single directory dialog:



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 .

There is a special RFE for multiple chosign directories, you can wait until it is fixed: https://bugs.openjdk.java.net/browse/JDK-8091403 , also you can vote for it to be fixed with a higher priority

+2


source







All Articles