How to access a JavaFx Stage from a Controller?
问题 I'm converting a pure JavaFx app, in which the code below worked fine when put all in one class, to a FXML one, where the Stage declaration and the button handler are in separate classes. In the a Controller, I'm trying to implement a method that will allow the user to choose a directory and store it in a variable for later use: private File sourceFile; DirectoryChooser sourceDirectoryChooser; @FXML private void handleSourceBrowse() { sourceDirectoryChooser.setTitle("Choose the source folder"