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

JFileChooser on GTK laf in 7-ea does not return multiselection correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 7
    • client-libs
    • None

      JDK 7 ea (build 1.7.0-ea-b143)
      Linux (ubuntu 10.10)
      GTK look and feel

      The bug manifests in NetBeans as
      http://netbeans.org/bugzilla/show_bug.cgi?id=197212

      The following sample code shows the problem:

          public static void main(String[] args) {
              try {
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
              } catch (Exception ex) {
                  Logger.getLogger(JFileChooserTest.class.getName()).log(Level.SEVERE, null, ex);
              }
              JFileChooser chooser = new JFileChooser();
              chooser.setFileHidingEnabled(false);
              chooser.setAcceptAllFileFilterUsed(false);
              chooser.setMultiSelectionEnabled(true);
              chooser.setDialogTitle("TXT_OpenClasses");
              chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
              chooser.setApproveButtonText("CTL_SelectCP");
              if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
                  System.out.println(Arrays.toString(chooser.getSelectedFiles()));;
              }
          }

      For single selection it prints out correctly

        [/home/tonda/a.txt]

      For three selected files it prints incorrectly

        [/home/tonda/ "a.txt" "b.txt" "c.txt"]

      instead of the expected

        [/home/tonda/a.txt, /home/tonda/b.txt, /home/tonda/c.txt]

            rupashka Pavel Porvatov (Inactive)
            anebuzel Antonín Nebuželský
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: