shaiko
shaiko

Reputation: 65

JavaFX Screen.getPrimary().getBounds() returns incorrect screen size

I have interesting problem when trying to get resolution (not pixel count but current working resolution) of user's monitor on Windows device. Screen.getPrimary().getBounds() returns correct result on ALMOST all systems. It has problems with Win 10 laptops. Their resolution is recognized as 1280x768 even if they are 4K and FullHD devices.

I also tried following approaches:

I have no more ideas. Is there some other way on how to correctly get screen resolution on ALL windows devices?

Upvotes: 2

Views: 5005

Answers (1)

mipa
mipa

Reputation: 10650

I neither know your devices nor Windows 10 in particular but there is one thing you should keep in mind. The reported size is not the physical pixel size of the device. Instead the scaled size is reported. On Windows this depends on the display settings of your device. My Mac for example has a physical pixel size of 2880x1800 but the reported size is 1440x900. Depending on your settings this is not always a factor of exactly 2.

Upvotes: 5

Related Questions