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

JFileChooser filter uses .toString() instead of getDescription() for filter text on GTK laf

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 6u71, 7u45, 7u51, 8
    • client-libs
    • Ubuntu Linux 12.04, Oracle Linux 6, GTK look and feel.

    • b44
    • linux

    Backports

      Description

        1. Set look and feel to GTKLookAndFeel
        2. Update JFileChooser component with SwingUtilities.updateComponentTreeUI.

        Result: Filter changed to a default toString() output
        Expected: Look and feel changed, filter text remains the same
        Reproducible: always

        Also reproducible if look and feel is changed when JFileChooser is already shown.
        How to reproduce (same file attached):

        import java.io.File;
        import javax.swing.JFileChooser;
        import javax.swing.SwingUtilities;
        import javax.swing.filechooser.FileFilter;

        /**
         *
         * @author lans
         */

        public class FilterTest {
            public static void main(String... args) throws Exception {
                JFileChooser chooser = new JFileChooser();
                chooser.setAcceptAllFileFilterUsed(false);
                chooser.addChoosableFileFilter(new FileFilter() {

                    @Override
                    public boolean accept(File f) {
                        return true;
                    }

                    @Override
                    public String getDescription() {
                        return "Whatever";
                    }
                });
                javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
                SwingUtilities.updateComponentTreeUI(chooser);
                chooser.showOpenDialog(null);
            }
        }


        Attachments

          1. FilterTest.java
            2 kB
            Andrey Rusakov
          2. FilterTest.java
            0.8 kB
            Andrey Rusakov

          Issue Links

            Activity

              People

                serb Sergey Bylokhov
                arusakov Andrey Rusakov (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: