Limit JavaFX FileChooser to the source folder

I want to limit JavaFX File chooser to my source directory.
I saw that this is possible in Swing ( How to restrict JFileChooser to a directory? ), But I could not find anything like it in java fx.

Is there any way to achieve this?

+4
source share
1 answer

This is probably an environment-based window, and until java defines a class for this (which in my opinion is not), you really can't do anything about it.

, , , null

File f = fileChooser.showOpenDialog(primaryStage);
if(f.getAbsolutePath().matches("regex")){
     //Do Something
}

regex -

[.+]//yourPath

regex,

0

Source: https://habr.com/ru/post/1651933/


All Articles