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

FileDialog opened on non HDPI display is not supporting different resolutions

    XMLWordPrintable

Details

    • x86_64
    • windows

    Description

      ADDITIONAL SYSTEM INFORMATION :
      System Windows 11 Pro, build 22623.1028
      Several versions of Java

      A DESCRIPTION OF THE PROBLEM :
      Hardware Details
      Main monitor:
        1920 x 1080 laptop screen at 150% HiDPI scaling at 14"
      Secondary monitor:
        1920 x 1080 external monitor, non-HiDPI (100% scaling)

      Java SE Version
      Version 1.8.0_351 is OK
      Version 11.0.17, 17.0.5 and 19.0.1 have differences

      Detailed Description of the Problem
      1) Run this application and move the FileDialog between the two screens over and over again. As you move from one to the other, the design changes.
      2) This fact is also observable with just one screen, keeping the application open and varying Display settings on the desktop, using the Scale & layout option.

      REGRESSION : Last worked in version 8u351

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the application in source code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Move the FileDialog between the two screens over and over again. As you move from one to the other, the design does not change.
      ACTUAL -
      Move the FileDialog between the two screens over and over again. As you move from one to the other, the design changes.

      ---------- BEGIN SOURCE ----------
      package openjdk;

      import java.awt.FileDialog;
      import java.awt.event.ActionEvent;

      import javax.swing.AbstractAction;
      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.UIManager;

      public class FileDialogTester {

          public static void main(String[] args) throws Exception {
              System.out.println("Java version: " + System.getProperty("java.version"));
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              new FileDialogTester(new JFrame());
          }
          
          public FileDialogTester(JFrame frame) {
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.add(new JButton(new AbstractAction("Push me to open a file dialog") {
      private static final long serialVersionUID = 1L;
      public void actionPerformed(ActionEvent e) {
                      FileDialog dialog = new FileDialog(frame, "Select File to Open", FileDialog.LOAD);
                      dialog.setVisible(true);
                  }
              }));
              frame.setSize(680, 480);
              frame.setVisible(true);
          }
      }

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

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              pnarayanaswa Praveen Narayanaswamy
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: