Screen display size

前端 未结 7 1000
长情又很酷
长情又很酷 2021-01-19 03:50

Hi I\'m writing a graphics program and I\'ve been searching for a way to get the physical size of the screen being used. I can get the size of the screen in pixels and also

7条回答
  •  星月不相逢
    2021-01-19 04:08

    No way with pure Java. The OS doesn't care about physical screen size. Resolution is all it needs. With native code you may be able to get the name of the connected display from the driver and try to look up the technical specs for this type.

    As Angus mentioned - it may even be possible that OS or driver can tell a dpi value for the connected screen but even in the best case, at least the screen has to report it's dpi/physical dimensions.

提交回复
热议问题