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

[hidpi] JFileChooser does not scale properly on Windows with HiDPI display and Windows L&F

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      windows_7, windows_8, windows_10

      Backports

        Description

        Under the Windows Look & Feel, most icons in the javax.swing.JFileChooser are not scaled properly. This applies both to the icons of shown files and icons shown as part of the UI (one-up, new folder, display mode).
        Further, the panel on the left (Recent, Desktop, Documents, ...) is scaled in such a way that the labels aren't fully visible. See attached screenshots.

        The problem occurs only with Windows Look & Feel, but with Windows 7, Windows 8.1, Windows 10 (those are the ones I tested).

        Steps to reproduce: Run this code:
        ----------------------------------
        import javax.swing.*;
        import java.awt.*;

        public class JFileChooserTest {

            public static void main(String[] args) {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (Exception e) {
                    e.printStackTrace();
                }

                SwingUtilities.invokeLater(() -> {
                    final JFrame frame = new JFrame();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setLayout(new BorderLayout());
                    final JButton open = new JButton("Open");
                    frame.add(open);
                    open.addActionListener(l -> {
                        final JFileChooser chooser = new JFileChooser();
                        chooser.showOpenDialog(frame);
                    });
                    frame.setBounds(200, 200, 200, 200);
                    frame.setVisible(true);
                });
            }
        }
        --------------------------------------
        1. windows10_hidpi_jdk9_b109.png
          65 kB
        2. windows10_hidpi_windows_laf.png
          36 kB
        3. windows10_jdk9_b114.png
          81 kB
        4. windows7_hidpi_windows_laf.png
          66 kB
        5. windows8_1_hidpi_windows_laf.png
          40 kB

          Issue Links

            Activity

            Hide
            alexsch Alexander Scherbatiy (Inactive) added a comment -
            The new bug should be created instead if there are issues with JFileChooser on HiDPI display with Windows L&F.
            Show
            alexsch Alexander Scherbatiy (Inactive) added a comment - The new bug should be created instead if there are issues with JFileChooser on HiDPI display with Windows L&F.
            Hide
            hschreiber Hendrik Schreiber added a comment -
            I've just tried using JFileChooser with Windows 7 and HiDPI on Java 8u102 (Windows L&F).
            It looks exactly like the screenshots in this bug report.

            So, should I simply create a new bug with the same content?
            Show
            hschreiber Hendrik Schreiber added a comment - I've just tried using JFileChooser with Windows 7 and HiDPI on Java 8u102 (Windows L&F). It looks exactly like the screenshots in this bug report. So, should I simply create a new bug with the same content?
            Hide
            alexsch Alexander Scherbatiy (Inactive) added a comment - - edited
            The fix was integrated into JDK 8u102 b03. It is strange if it does not work there.
            After that it has been removed from the JDK 8u112 b01 because of the issue:
            JDK-8157838 Personalized Windows Font Size is not taken into account in Java8u102

            See the discussion: http://mail.openjdk.java.net/pipermail/awt-dev/2016-May/011359.html
            Show
            alexsch Alexander Scherbatiy (Inactive) added a comment - - edited The fix was integrated into JDK 8u102 b03. It is strange if it does not work there. After that it has been removed from the JDK 8u112 b01 because of the issue: JDK-8157838 Personalized Windows Font Size is not taken into account in Java8u102 See the discussion: http://mail.openjdk.java.net/pipermail/awt-dev/2016-May/011359.html
            Hide
            hschreiber Hendrik Schreiber added a comment -
            Regardless what happened to it: How do we proceed?
            Create a new bug with the same content?
            Show
            hschreiber Hendrik Schreiber added a comment - Regardless what happened to it: How do we proceed? Create a new bug with the same content?
            Hide
            alexsch Alexander Scherbatiy (Inactive) added a comment -
            Yes, just create a new issue, target it to JDK 8 and link to the JDK-8157838
            Show
            alexsch Alexander Scherbatiy (Inactive) added a comment - Yes, just create a new issue, target it to JDK 8 and link to the JDK-8157838

              People

              • Assignee:
                alexsch Alexander Scherbatiy (Inactive)
                Reporter:
                hschreiber Hendrik Schreiber
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: