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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 6u71, 7u45, 7u51, 8
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
    • Environment:

      Ubuntu Linux 12.04, Oracle Linux 6, GTK look and feel.

    • Subcomponent:
    • Resolved In Build:
      b44
    • OS:
      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

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: