JDK-4843574 : GTK+ JFileChooser doesn't open multiple files
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: javax.swing
  • Priority: P3
  • Affected Version: 1.4.2
  • OS: linux
  • CPU: x86
  • Submit Date: 2003-04-07
  • Updated Date: 2003-11-11
  • Resolved Date: 2003-11-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
1.4.2_04 04Resolved
Description

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) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.2_04 tiger-beta FIXED IN: 1.4.2_04 tiger-beta INTEGRATED IN: 1.4.2_04 tiger-b28 tiger-beta
2004-08-24

EVALUATION Reproducible as indicated. ###@###.### 2003-04-07 Name: pzR10082 Date: 10/17/2003 GTKFileChooserUI.getFileName() returns just one filename -- one of the file selected first. It should return a String containing all file names in quotes, like '"a.txt" "b.txt" "c.txt"'. ###@###.### ====================================================================== Name: pzR10082 Date: 10/21/2003 Method GTKFileChooser.getFileName() will be overridden to return all files selected in the list plus the name typed into the text field. ###@###.### ======================================================================
2004-08-24