Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

There is the Directory chooser but it selects only one folder. How can i solve this problem. Please give me any suggestion?

like image 848
Amit Gujjar Avatar asked Oct 06 '22 00:10

Amit Gujjar


2 Answers

JavaFX supports single and multiple file dialogs:

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

There was a special RFE for this : 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

like image 157
Alexander Kirov Avatar answered Oct 10 '22 22:10

Alexander Kirov


We can use JFileChooer of Swing component. But then its give error like Headless something. So remove this error by following steps.

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

Then jfilechooser works. Thanks to all.

like image 26
Amit Gujjar Avatar answered Oct 10 '22 23:10

Amit Gujjar