How to fix java application dimensions when switching the jre from 8u201 to 8u211?

330 Views Asked by At

So i'm working on this java swing application that is currently running on Java 8 update 192.

It works fine on this update but when I upgrade the java version to 8 update 211, it seems to change the UI of the application so everything seems so much bigger, no code changes are done after switching these versions.

Does anyone know any good resolutions to this issue?

Both images are to the same relative scale, so the after image is much bigger with lower res icons.

Before:

enter image description here

After: enter image description here

1

There are 1 best solutions below

6
Sully On

https://www.oracle.com/java/technologies/javase/8u211-relnotes.html

You can see:

High DPI Auto-Scaling on Windows

If the Windows desktop DPI of the default screen is configured via Display Settings to be 150% or greater (that is 144 dpi or greater), JDK will now ask Windows to auto-scale the entire UI of a Java application to be consistent with the rest of the Windows desktop UI.

Below that value Java applications will appear at the same size as they did in previous releases.

This threshold is chosen as a trade-off between compatibility and legibility of the UI. At higher DPI settings, without this auto-scaling, the Java UI may be just too small to be read comfortably.

There may be some negative consequences such as

  • Some elements of the UI may appear somewhat blurry, particularly if the scaling factor is a non-integral value (that is 1.5 rather than 2.0).

  • ClearType text is not effective when auto-scaling so grey scale anti-aliasing is used instead by the Swing toolkit.

  • Window sizing and positioning calculations may be adversely affected.

In the event that the negative consequences outweigh the benefits, an application can request the old behaviour by specifying:

-Dsun.java2d.dpiaware=true

Conversely, if the application would prefer to be auto-scaled even at lower DPI settings, then specify:

-Dsun.java2d.dpiaware=false

In the absence of either explicit setting, the default behaviour described above will apply.

JDK-8204512 (not public)

core-libs/java.lang