JDK-4239219 : JFileChooser in directory mode requires you to be in parent dir of dir to select
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.1,1.2.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 1999-05-18
  • Updated: 2000-10-11
  • Resolved: 2000-10-11
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 Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description

Name: skT88420			Date: 05/18/99


Simple directory choice:
---------------------------------------------------------
import javax.swing.JFileChooser;
JFileChooser jfc = new JFileChooser ();
jfc.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
System.out.println (jfc.showDialog (null, null));
System.out.println (jfc.getSelectedFile ());
---------------------------------------------------------
This permits the user to select a directory which will be returned
to the application. However, in my experience (working with tech
support for a Swing-based app which uses code such as this) many
users do *not* understand that they must be in the parent directory
of the directory they want, and then select (but not traverse) the
desired directory, then click OK--they repeatedly try to traverse
into the directory and immediately click OK, which does not close
the dialog since there is no selection. The behavior is correct,
but the UI is confusing for naive users (e.g. I believe some Windows
directory chooser dialogs require the chosen directory to be traversed
first, or at least permit it).

As a side effect, it does not appear possible to choose the root
directory of a mountable drive on Windows, unless there is some
trick to this that I am missing, other than explicitly entering
the drive, e.g. "e:\", in the selection textbox.

Is there some way to gently steer naive users toward navigating to
the parent directory? E.g. if they click OK with no selection,
when in directory-choosing mode, prompt them whether to select
the current directory, or something?
(Review ID: 83219) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic merlin-beta FIXED IN: merlin-beta INTEGRATED IN: merlin-beta
14-06-2004

WORK AROUND Name: skT88420 Date: 05/18/99 None that I am aware of. ======================================================================
11-06-2004

EVALUATION Excellent write up of this problem. We should make this easier to use. jeff.dinkins@Eng 2000-03-09 The solution for merlin is based on the requested functionality: 1) When choosing DIRECTORIES_ONLY, the textfield will always show the full path to a selected directory, instead of the relative name as before. It is still possible to type in a relative name, however. 2) The textfield will always show the path of the current directory when the dialog is first opened and when traversing into a new directory. The exception is with folders that can not be returned, such as the special shell folders on Windows (e.g. My Computer). This means that it will not be necessary to go up one level to select the directory you're in. This also allows returning the top level directory (root). However, if you select a folder in the list without approving the selection and then change your mind and want to return the current directory, then you will probably have to change directory and come back (or edit the textfield by hand). Changes apply to Metal and Windows L&F. leif.samuelsson@Eng 2000-09-28
28-09-2000