JDK-8187151 : java no longer high-DPI-aware on windows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows
  • CPU: generic
  • Submitted: 2017-08-29
  • Updated: 2017-10-06
  • Resolved: 2017-09-05
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

EXTRA RELEVANT SYSTEM CONFIGURATION :
display scaling more than 100%

A DESCRIPTION OF THE PROBLEM :
Java 9 appears to no longer be high-dpi-aware on Windows.


REGRESSION.  Last worked in version 8u152

ADDITIONAL REGRESSION INFORMATION: 
Was working in some 9 early access releases, but I don't remember the last one I used.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run on Windows 7 with display scaling (I'm using 170% scaling).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect same approximate file chooser window and text size as for Java 8, and for icons to be rendered consistently.
ACTUAL -
File chooser and font size are scaled up under Java 9, and icons are rendered inconsistently due to OS image-like scaling.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.io.File;

public class DpiAwareBug {
   public static void main(String args[]) {
      SwingUtilities.invokeLater(
         new Runnable() {
            public void run() {
               JFileChooser fc = new JFileChooser();
               fc.showOpenDialog(null);
            }
         });
   }
}

---------- END SOURCE ----------


Comments
This is 'not a bug'. Previously JDK told windows it was hi-dpi aware just so that windows would not auto-scale it .. since JDK was not at all hi-dpi aware. Now in fact it IS hi-dpi aware in 9: https://bugs.openjdk.java.net/browse/JDK-8055212 So JDK's application window (file chooser, text, icons) are at the correct physical size. All general rendering is now at that proper scale but nothing can make canned images scale up perfectly. For this an application needs to provide images that are suitable for the DPI.
05-09-2017

Verified in windows 10 and Issue is reproducible in windows but not in linux. JDK results: 8u152 : Pass 9-ea+b01 : Pass 9-ea+95 : Pass 9-ea+96: Fail <--- regression introduced here 9-ea+181 : Fail
04-09-2017