This discussion is archived
2 Replies Latest reply: Nov 25, 2012 7:07 AM by 883781 RSS

How to access a stage from a FXML controller class?

925065 Newbie
Currently Being Moderated
Is it possible to access the stage inside a controller?
In my case I would like to open a file chooser dialogue from an action event handle method like this:
@FXML
protected void handleMenuItemAction(final ActionEvent event) {
    final FileChooser fileChooser = new FileChooser();
    final File importFile = fileChooser.showOpenDialog(stage.getOwner());
    ...
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points