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

FileDialog scales incorrectly with two monitors at different application scales.

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 Home version 20H2 running on a Lenovo Legion 5

      A DESCRIPTION OF THE PROBLEM :
      When FileDialog is used, the window that it creates is scaled incorrectly due to the system's scaling setting for text and applications. This happens with two monitors, only when both monitors are at a different scale from one another. When the FileDialog window is dragged across the screens multiple times, the window repeatedly shrinks until the entire window displays practically nothing.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Have a Windows system with two monitors. Each monitor must have a different scale, which can be set by going to Windows Settings -> System -> Display -> Scale and layout -> Change the size of text, apps, and other items.

      2. Create and run a new Java program that creates and shows a FileDialog window.

      3. Notice that when the window that is displayed is on the monitor with the lower scale, there is too much "white space" (margins) on the right and bottom.

      4. Drag the window across the border between the monitors (specifically past the point where Windows resizes it) and notice that the margins grow every time the window is brought to the monitor with the lower scale.

      5. This can be repeated so that the only GUI elements displayed are the elements labeled "Look in:" and "Files of."

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The margins on the window created by FileDialog scale properly across monitors
      ACTUAL -
      The margins on the window created by FileDialog scale incorrectly across monitors, and shrinks every time it is brought to the monitor with the smaller scale.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;

      public class Main {
      public static void main(String[] args) {
      FileDialog fD = new FileDialog((Dialog)null);
      fD.setVisible(true);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      If you have a multi-monitor setup, keep both monitors at the same scale (though this can be inconvenient).

      FREQUENCY : always


        Attachments

        1. Capture.PNG
          18 kB
          Pardeep Sharma
        2. Main.java
          0.2 kB
          Praveen Narayanaswamy

          Activity

            People

            Assignee:
            azvegint Alexander Zvegintsev
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: