在 JavaFX 中获取当前阶段的 GraphicsDevice

Getting current stage GraphicsDevice in JavaFX

是否可以获取当前JavaFX阶段的GraphicsDevice?

我知道您可以通过 Screen.getScreensForRectangle 方法获取当前屏幕,但我确实需要 GraphicsDevice。

使用 Screen method, e.g. one of the getScreensForRectangle(), to find the screen of interest. In the GraphicsEnvironment obtained from getLocalGraphicsEnvironment(), iterate though each GraphicsConfiguration of each GraphicsDevice to find those devices whose bounds intersect the bounds obtained from screen.getBounds(). There may be more than one. A typical iteration scheme is shown here.