posted 18 years ago
I have a JFileChooser in which a user needs to select a save-to directory (to which to save a batch of files). After using it, a few people have commented that it would be good to allow users to actually see the files that exist in the directory, before they choose that directory (which makes sense, IMHO). But again, the user shouldn't be allowed to actually select a file.
Problem is, JFileChooser seems to tightly couple what a user can see and what they can select. I've been playing around with a few kludges without anything I results that I consider satisfactory. For example, set the file selection mode to FILES_AND_DIRECTORIES, and if the user selects a file, then behind-the-scenes just use that file's parent. But that's non-intuitive and misleading from a UI perspective. Or, use FILES_AND_DIRECTORIES mode but if the user selects a file, then set the current selection to that file's parent... but that causes the UI to jump around.
So, is there something basic I am missing? Or has anyone ever successfully tackled that problem?
Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>