JavaFX FileChooser

Now I am facing a small problem with JavaFX. I tried to make filechoosing in my code where I can point to FOLDER instead of a file. I currently have no solution for this. Do you know a workaround (except for using JFileChooser from swing)?

Thanks so much for the answers in advance.

edit: I already got the answer trying to test it, but I forgot to mention the JavaFX version. This is the last stable version 2.0.3 released a few days ago (but the original non-beta version 2.0 and 2.0.1 also had this problem)

+43
directory folder javafx filechooser
Feb 21 '12 at 10:31
source share
1 answer

DirectoryChooser was added to JavaFX as part of version 2.1 . Using:

DirectoryChooser chooser = new DirectoryChooser(); chooser.setTitle("JavaFX Projects"); File defaultDirectory = new File("c:/dev/javafx"); chooser.setInitialDirectory(defaultDirectory); File selectedDirectory = chooser.showDialog(primaryStage); 

The bug tracker mentions a workaround for the 2.0GA release: "access to the Oracle API Glass Private API CommonDialogs.showFolderChooser."

+81
Feb 22 '12 at 1:18
source share



All Articles