scene = stage.getScene();scene.widthProperty().addListener((observable, oldValue, newValue) -> { System.out.println("Width has changed from " + oldValue + " to " + newValue );});