Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8157396

Screen.getDpi() returns a wrong value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u92
    • javafx
    • x86
    • other

      FULL PRODUCT VERSION :
      1.8.0_92

      ADDITIONAL OS VERSION INFORMATION :
      10.0.10586

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I have only one Screen (laptop)

      A DESCRIPTION OF THE PROBLEM :
      The value returned by Screen.getPrimary().getDpi() is incorrect on Windows 10 on my PC, while it is OK in AWT with the Toolkit.getDefaultToolkit().getScreenResolution() method.

      In my case, Screen.getPrimary().getDpi() returns 106, while Toolkit.getDefaultToolkit().getScreenResolution() returns the correct value (96).

      I should note that I upgraded my PC from 7 to 10, and on 7 rthe result was correct.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the Screen.getPrimary().getDpi() method.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The expected result as the same as for the AWT method, Toolkit.getDefaultToolkit().getScreenResolution() : 96.
      ACTUAL -
      The result is incorrect: 106

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      double density = Screen.getPrimary().getDpi();
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use the AWT equivalent method.

            flar Jim Graham
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: