I am willing to adapt font size of a chart according to pixel scale (text look tiny when running on Retina or HiDPI).
In the case the user moves the app from an HiDPI main screen to a NON-HiDPI secondary screen, the pixel scale for rendering changes (as soon as one pixel of the app goes to a non HiDPI screen, the entire chart becomes non HiDPI - cooool!).
I wish I could add a listener somewhere to get notified of this change to avoid asking to the GLAutoDrawable its values in a loop/thread.
Here is an example of how I did it in Jzy3D where the canvas owner fires a pixel scale change event to its listeners.
This allows updating everything that may be impacted by a change in pixel scale : resize text to keep it the same size visually, change the image used in overlays so that they do not look shrinking or bumping as soon as the application moves from a HiDPI screen to a non HiDPI screen.
This works well at the cost of an additional thread. I am interested by any improvement suggestion!
With Java 8 and older, I don't know of a way to detect that. With Java 9 and newer, you can use use "((Graphics2D) getGraphics()).getTransform().getScaleX()" in your resize() method. No need to poll, the resize() method will be called when it changes.