use of javafx.stage.DirectoryChooser in project Gargoyle by callakrsos.
the class DialogUtil method showDirSaveDialog.
public static File showDirSaveDialog(Window ownerWindow, File initDir, Consumer<DirectoryChooser> option) {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setInitialDirectory(initDir);
chooser.setTitle("Directory");
if (option != null)
option.accept(chooser);
File selectedDir = chooser.showDialog(ownerWindow);
if (selectedDir != null && selectedDir.exists()) {
applyLastPath(selectedDir);
}
return selectedDir;
}
Aggregations