JDK-8180815 : Java Swing Applications are not scaled in Windows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u131
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2017-05-22
  • Updated: 2017-09-18
  • Resolved: 2017-08-29
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
Java Swing applications are not scaled according to the windows' system settings.

There was a flag in 1.6 like this:
-Dsun.java2d.dpiaware=false

This does not work anymore.

So we do not have the possibility to deliver a swing application that does scale how it should.
I really like to decide on my own whether the application is scaled or not.
So please reintroduce the flag again or find some other solution.

This bug here is open for 2 years:
https://bugs.openjdk.java.net/browse/JDK-8080153

REGRESSION.  Last worked in version 6u45

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.) use windows 7/8/10
2.) set display scaling to e.g. 150%
3.) create an arbitrary litte application just shown an JFrame



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
there should be an flag like:
-Dsun.java2d.dpiaware=false
or something similar
ACTUAL -
no way to deliver an application, that scales correctly, how we define it.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
There are three workarounds currently:

1.) open the properties on the java.exe and javaw.exe. Check the compatibility and switch the dpi scaling from "application to "system"
This is quite annoying, because every user of our software needs to do this.

2.) open the javaw.exe or java.exe with a resource editor tool, and change the manifest file by setting the value "dpiAware" to false.
This is not allowed because it would be a breach of lisense agreement.

3.) force Windows to prefer external manifests. Create manifest files for the java.exe and javaw.exe.
This is also cumbersome and may be a security issue.



Comments
Closing - Won't Fix (For JDK 8) Please utilize the solution with JDK 9, or raise a customer support case.
29-08-2017

The attached screenshot confirms that the issue does not exist in 9. Therefore, updating affected version to default mention in the report, 8u131. Also received following update/confirmation from the submitter: "It is great to see, that this issue seems to be solved in Java9. I did read in some sites (e.g. stackoverflow), that the behavior about the DPI scaling could be configured by the mentioned flag, and that it does not work anymore. I did not retest this on my own. I noticed that it is possible to open java(w).exe with a resource tool and to switch the ���dpiAware��� flag in the manifest, but that is not a solution since it is a breach of the license. The expected result is actually the behavior is it is in 9 ea: UI is scaled according to the system settings (must have) and the fonts are good (nice to have). I made a test with 8.u131 and 9 ea and as I said this issue is solved. Even better, the fonts are ���crisply��� and clear, not blurred like in 8u131. The easy to make test case is quite similar like the one you used. I also just created a frame and show it. My JFrame is small in 8u131 (left side) and scaled in 9 ea (right hand side). (screenshot attached). So you could consider this to be fixed, actually. Cool. But I did read somewhere in the forums, that there was a software with a medical use case, that needed to have the application be displayed NOT scaled. Don���t know. So I think, making this configurable would be the best approach. The default state could be the behavior as it is in 9 ea, but switching it off could be necessary for some applications. Could this behavior be done in a 1.8 update? There is the possibility to set the scaling behavior in Windows 10: http://ariscommunity.com/system/files/images/Image%204%282%29.png The screenshot is in German, and means something like ���overwrite behavior at high DPI scaling. Let scaling be done by:��� and ���system��� is chosen.
29-05-2017

please re-open on requested info
24-05-2017

JDK 9 delivers hidpi for windows as per JEP http://openjdk.java.net/jeps/263 So I am thrown by the "affects 9" comment and indeed it scales fine on 9. The submitter mentioned only JDK8u131. Pardeep added JDK 9. Pardeep: please re-evaluate what you wrote and make sure you have scaling set up for windows first.
23-05-2017

is it JDK-8080153 dup?
23-05-2017

On Windows 10 (64-bit) with scaling set to 150%, run the attached example, following steps from the description. When checked this for JDK 8u152 ea b03 and 9 ea b170, could verify the concern. This seems to be a known issue (JDK-8080153) which is still open.
23-05-2017