JavaFX 中有没有办法检测舞台/窗口位置相对于屏幕何时发生变化?
我可以检测到何时调整舞台大小,但无法检测到何时重新定位舞台。
最佳答案
The horizontal location of this Stage on the screen. Changing this attribute will move the Stage horizontally. Changing this attribute will not visually affect a Stage while fullScreen is true, but will be honored by the Stage once fullScreen becomes false.
stage.xProperty().addListener((obs, oldVal, newVal) -> System.out.println("X: " + newVal));
stage.yProperty().addListener((obs, oldVal, newVal) -> System.out.println("Y: " + newVal));
关于JavaFX 检测舞台屏幕位置的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38047119/