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

XMLWordPrintable

    • generic
    • windows_7, windows_8, windows_10

        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
            Hendrik Schreiber
          2. windows10_hidpi_windows_laf.png
            36 kB
            Hendrik Schreiber
          3. windows10_jdk9_b114.png
            81 kB
            Hendrik Schreiber
          4. windows7_hidpi_windows_laf.png
            66 kB
            Hendrik Schreiber
          5. windows8_1_hidpi_windows_laf.png
            40 kB
            Hendrik Schreiber

              alexsch Alexandr Scherbatiy
              hschreiber Hendrik Schreiber
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: