gpt4 book ai didi

JavaFX 检测舞台屏幕位置的变化

转载 作者:行者123 更新时间:2023-11-30 07:18:10 25 4
gpt4 key购买 nike

JavaFX 中有没有办法检测舞台/窗口位置相对于屏幕何时发生变化?

我可以检测到何时调整舞台大小,但无法检测到何时重新定位舞台。

最佳答案

您可以使用xPropertyyProperty 窗口

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com