Stage stage = new Stage();
stage.widthProperty().addListener((obs, oldVal, newVal) -> {
//on change width
});
stage.heightProperty().addListener((obs, oldVal, newVal) -> {
//on change height
});
stage.widthProperty().addListener((obs, oldVal, newVal) -> {
// Do whatever you want
});
stage.heightProperty().addListener((obs, oldVal, newVal) -> {
// Do whatever you want
});
stage.minHeightProperty().bind(stage.widthProperty().multiply(0.5));
stage.maxHeightProperty().bind(stage.widthProperty().multiply(0.5));
container.widthProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
if (newValue.floatValue()!=oldValue.floatValue()) resizeKids(newValue);
}
});