Friday, November 24, 2017

JAVAFX - How get Stage from control

From control you can get Stage; here used for form closing:
@FXML Button btnClose;

@FXML private void btnCloseAction( ActionEvent event ) {
  Stage stage = (Stage) btnClose.getScene().getWindow();    
  stage.close();    
}

No comments:

Post a Comment