How to add a window resize listener?
raamipja opened this issue · comments
I want to add window resize listener with this project.
I tried with this code.
myStage.widthProperty().addListener(new ChangeListener<Number>() {
@Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) {
System.out.println("Width: " + newSceneWidth);
}
});
myStage.heightProperty().addListener(new ChangeListener<Number>() {
@Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneHeight, Number newSceneHeight) {
System.out.println("Height: " + newSceneHeight);
}
});
But , it failed.
Can you give a solution for this?
Hi. I applied your code and finished the solution.