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