Andy
Andy

Reputation: 8620

Get device pixel ratio on desktop java

I need to get the device pixel ratio in a desktop Java app to implement correct behavior on MacBook retina screens.

The app uses Swing and JOGL. Is there any way to do this via AWT or any JOGL/JOGAMP APIs like NativeWindow or NEWT?

JOGL is drawing graphics at full resolution, but AWT MouseEvents seem to be in logical pixels, which is the source of the problems I'm having. Maybe NEWT's Screen class knows the physical resolution, and I can compare this to the resolution AWT reports (which I assume is in logical pixels) to determine the device pixel ratio? But it would be nice if there were a simpler method.

Upvotes: 2

Views: 295

Answers (0)

Related Questions