United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4239219 JFileChooser in directory mode requires you to be in parent dir of dir to select
4239219 : JFileChooser in directory mode requires you to be in parent dir of dir to select

Details
Type:
Bug
Submit Date:
1999-05-18
Status:
Resolved
Updated Date:
2000-10-11
Project Name:
JDK
Resolved Date:
2000-10-11
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.2.1,1.2.2
Fixed Versions:
1.4.0

Related Reports
Duplicate:
Relates:
Relates:

Sub Tasks

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


                                     
2004-06-14
WORK AROUND



Name: skT88420			Date: 05/18/99


None that I am aware of.
======================================================================
                                     
2004-06-11
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
                                     
2000-09-28



Hardware and Software, Engineered to Work Together