How can I detect when a Scene or Stage changes size in JavaFX 2.1? I cannot find any EventHandler for this.
There are heightProperty
and widthProperty
. You can use these properties for binding, or add listeners to them.
public void start(Stage stage) {
Scene scene = new Scene(new Group(), 300, 200);
stage.setScene(scene);
stage.titleProperty().bind(
scene.widthProperty().asString().
concat(" : ").
concat(scene.heightProperty().asString()));
stage.show();
}
Or see next example: https://stackoverflow.com/a/9893911/1054140
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With