Name: jk109818 Date: 05/05/2003
FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
The JFileChooser behaves differently when selecting the drives (partitions/harddrives) if you have DIRECTORIES_ONLY or FILES_AND_DIRECTORIES mode.
The problem is that when I have the DIRECTORIES_ONLY, I can go up to the "My computer" level and select one of the drives and the filechooser returns the correct path. When I select one of the directory its correct path comes up in the the textfield below the file view (ie if I click on the C-drive then "c:" comes up)
But when I need to let the user be able to select a FILE or a DIRECTORY, then this doesnt work anymore. Ive set the mode to FILES_AND_DIRECTORIES. When I go up to the "My computer" level in the filechooser I cant select any of the partitions/harddrives but I can go into the drives and select any path or file within. Also when Im at the "My computer" level when I click on a drive then no text shows up in the textfield (ie if i click on the C-drive no "c:" comes up in the field). If Ive clicked on the drive then I cant click on OK, since nothing is apparently selected (doh).
As I thought this would work is that when Im at the "My computer" view I can either select one drive as a path or go into the drive and select a dir or a file. But now I cant select the drive I can only go into the drive.
Since this works when I have the DIRECTORIES_ONLY mode set I think this is a bug, since the FILES_AND_DIRECTORIES would be the same BUT also able to select files.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile below code, go to the "My computer" view and try to select a drive, which I cant.
Then set the other mode (JFileChooser.DIRECTORIES_ONLY) by commenting the JFileChooser.FILES_AND_DIRECTORIES line out and uncomment the line below. This will make it possible to select a drive in the "My computer" view.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The user should be able to select a drive in the "My computer" view as the user is able in the other (JFileChooser.DIRECTORIES_ONLY) mode.
The drive can not be selected in the JFileChooser
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
class TEST
{
public static void main( String args[] )
{
JFileChooser bufferFileChooser = new JFileChooser();
bufferFileChooser = new JFileChooser();
bufferFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
//bufferFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
System.out.println("filechooser="+bufferFileChooser.showOpenDialog(null));
}
}
---------- END SOURCE ----------
(Review ID: 183359)
======================================================================