I'm developing an application using JavaFX and I have to use a DirectoryChooser. I'm calling it through the following code:

 DirectoryChooser chooser = new DirectoryChooser();
 chooser.setInitialDirectory(new File("~/Downloads/"));
 chooser.initialDirectoryProperty();
 chooser.setTitle("JavaFX Projects");
 
 Button browse = new Button("Browse");
 browse.addEventHandler(MouseEvent.MOUSE_CLICKED,
            new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent e) {
                     File  file=chooser.showDialog(MyStage);
 
                    if (file != null) {
 
                     downloadPath.setText(file.getPath());
 
                    }
 
                }
            });


On Mac OS X DirectoryChooser opens, but it doesn't set customized title and the app isn't blocked by it, I can still use it and open other DirectoryChooser dialogs.

On Windows systems the same code works perfectly, both title setting and app blocking.

Thanks for your help