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

getBounds returns incorrect size when using remote desktop

XMLWordPrintable

    • x86_64
    • windows_10

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      My monitor's resolution is 1920x1200 and at 150% DPI. I get incorrect value when calling the "getBounds" of the screen configuration when I remote desktop to this machine.

      I get the value as

      java.awt.Rectangle[x=0,y=0,width=1280,height=800]

      instead of

      java.awt.Rectangle[x=0,y=0,width=1920,height=1200]

      It looks like it is using the DPI of the machine I am remoting from (i.e. 100% DPI)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      On a remote Machine (machine_150dpi)

      1. Set the DPI to 150%. (Control Panel --> Adjust Screen Resolution -->Make text and other items larger or smaller --> Larger - 150%)

      On a client machine (machine_100dpi)

      1. Remote to the remote machine "machine_150dpi"
      2. Run java code to get the bounds of the screen


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      java.awt.Rectangle[x=0,y=0,width=1920,height=1200]

      ACTUAL -
      java.awt.Rectangle[x=0,y=0,width=1280,height=800]

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.GraphicsConfiguration;
      import java.awt.GraphicsDevice;
      import java.awt.GraphicsEnvironment;

      public class Bug {

          public static void main(String [] args) {
              GraphicsDevice screenDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
              GraphicsConfiguration config = screenDevice.getDefaultConfiguration();
              System.out.println("Screen bounds are " + config.getBounds());
          }
      }
      ---------- END SOURCE ----------

            kaddepalli Krishna Addepalli
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: