How to listen resize event of Stage in JavaFX?
问题 I want to perform some functionality on resize event of form (or Scene or Stage whatever it is). But how can I detect resize event of form in JavaFX? 回答1: You can listen to the changes of the widthProperty and the heightProperty of the Stage : stage.widthProperty().addListener((obs, oldVal, newVal) -> { // Do whatever you want }); stage.heightProperty().addListener((obs, oldVal, newVal) -> { // Do whatever you want }); Note: To listen to both width and height changes, the same listener can be