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

Selecting file filter in file open dialog runs several file loading threads

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • client-libs
    • None

      To reproduce the issue run the code below and select "All Files" file format in JFileDialog.
      More than one "Aqua L&F File Loading Thread" (see AquaFileSystemModel.FilesLoader) is run.
      ---------------------
      import javax.swing.JFileChooser;
      import javax.swing.SwingUtilities;
      import javax.swing.filechooser.FileFilter;
      import javax.swing.filechooser.FileNameExtensionFilter;

      public class JFileChooserSample {

          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeLater(JFileChooserSample::createAndShowGUI);
          }

          private static void createAndShowGUI() {
              JFileChooser fileChooser = new JFileChooser();
              fileChooser.setAcceptAllFileFilterUsed(true);
              fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);

              FileFilter txtFilter = new FileNameExtensionFilter("Text files", "txt");
              fileChooser.addChoosableFileFilter(txtFilter);
              fileChooser.setFileFilter(txtFilter);
              fileChooser.showOpenDialog(null);
          }
      }
      ---------------------

            Unassigned Unassigned
            alexsch Alexandr Scherbatiy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: