I am using javafx along with fxml, so I use the controller for the real coding. I need to do a few operations on the stage, such as getting
From your root Pane in the fxml file :
fxml
@FXML Parent root
You can get the stage from it by:
Stage stage = (Stage) root.getScene().getWindow()
You have a reference to your stage, you can do what you want.