How to access Windows 10 scaling value in Java?

Viewed 367

I'm creating a simple sticky note app in Java, and use the following code to set its font size:

    Font systemDefault = super.getFont();

    int style = systemDefault.getStyle();
    int size = systemDefault.getSize();
    String name = "Arial";

    noteFont = new Font(name, style, size); 

This works perfectly fine for Windows systems with the scaling value set at 100%, but will produce an inadequately small font size if the system scaling value is set at anything higher. (For example, I use a 200% scaling value on my Surface Pro.)

Is there any way that I could access the Windows scaling value from my Java application and use that value to adjust the provided system font size according to scale?

0 Answers
Related