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

Details

    • generic
    • 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);
                });
            }
        }
        --------------------------------------

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: