When user change Display settings scaling (Windows 10, right click on desktop, select Display settings and scale to 150%), suddenly all values reported by
GraphicsDevice device = MouseInfo.getPointerInfo().getDevice();
Rectangle bounds = device.getDefaultConfiguration().getBounds();
or
Toolkit.getDefaultToolkit().getScreenSize();
or
GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
become invalid. Is there a way how to get the actual values ?
Found solution that seems to respect the Display settings.
javafx.geometry.Rectangle2D r = new javafx.geometry.Rectangle2D(0, 0, 1, 1);
ObservableList<Screen> screens = Screen.getScreensForRectangle(r);
if (screens != null && screens.size() > 0) {
javafx.geometry.Rectangle2D rc = screens.get(0).getBounds();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With