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

[macosx] Directories are not deselected when JFileChooser has FILES_ONLY selection mode

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • None
    • client-libs
    • Mac OS X
      Java(TM) SE Runtime Environment (build 1.6.0_29-b11-397-11M3521)

    Description

      Java(TM) SE Runtime Environment (build 1.6.0_29-b11-397-11M3521)

      Steps to reproduce:
      - Run the code below:
      ----------------------------
      import java.io.*;
      import javax.swing.*;

      public class FileChooserDirTest {

          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  @Override
                  public void run() {

                      JFileChooser chooser = new JFileChooser();
                      chooser.setMultiSelectionEnabled(true);
                      chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
                      int returnVal = chooser.showOpenDialog(null);
                      if (returnVal == JFileChooser.APPROVE_OPTION) {
                          File[] files = chooser.getSelectedFiles();
                          for(File file: files){
                              System.out.println("Selected file: " + file);
                          }
                      }
                  }
              });
          }
      }
      ----------------------------

      - Select both files and directories
      The directories are not deselected

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: