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

GTK+ JFileChooser doesn't open multiple files

XMLWordPrintable

    • 04
    • x86
    • linux



        Name: rmT116609 Date: 04/06/2003


        FULL PRODUCT VERSION :
        java version "1.4.2-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
        Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

        FULL OS VERSION :
        Red Hat Linux 9, kernel 2.4.20, i686
        Windows 2000

        A DESCRIPTION OF THE PROBLEM :
        The JFileChooser does not open multiple files when using the GTK+ look and feel. Only the first file listed is returned in the array from getSelectedFiles(); the array has length 1. The Metal look and feel returns an array of all the chosen files.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1) Choose setMultiSelectioneEnabled(true).
        2) Open the JFileChooser.
        3) Highlight 2 or more files.
        4) Click on the accept button.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        All the files will be returned from getSelectedFiles().
        Only the first file listed is returned. getSelectedFiles() returns an array of length 1.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javax.swing.*;
        import java.io.*;

        public class GTKJFileChooserTest {

        public static void main(String[] args) {
        try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk"
        + ".GTKLookAndFeel");
        } catch (Exception e) {}
        JFileChooser chooser = new JFileChooser();
        chooser.setMultiSelectionEnabled(true);
        chooser.showOpenDialog(null);

        File[] files = chooser.getSelectedFiles();
        System.out.println("Num of files: " + files.length);
        for (int i = 0; i < files.length; i++) {
        System.out.println("File " + i + " " + "path: "
        + files[i].getPath());
        }
        }
        }
        ---------- END SOURCE ----------

        (Review ID: 183630)
        ======================================================================

              peterz Peter Zhelezniakov
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: