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
With *.FXML files and Controllers and not with Main or Events , use this :
@FXML private Stage stage; stage = (Stage) elemen.getScene().getWindow();
element, can be any control or element in you FXML, in my case is an AnchorPane:
@FXML private AnchorPane element;