?
Solved

Select a directory in a FileDialog?

Posted on 1998-09-03
2
Medium Priority
?
2,058 Views
Last Modified: 2008-02-01
I'm trying to use a FileDialog to allow a user to choose a specific directory instead of a file.  How do I make the dialog allow a directory to be chosen and return the name of the directory (so I can use it as a File object) instead of simply opening the directory and listing its contents?  I've tried creating a new FilenameFilter and passing it to the FileDialog using setFilenameFilter, but it didn't work.

Do I need to go about this some other way?

I'm using Java 1.1 on Win95.
0
Comment
Question by:oucher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

by:evijay
ID: 1223556
you have to write your own or use swing (jfc) jfilechooser which allows you to do that

0
 
LVL 3

Accepted Solution

by:
sailwind earned 200 total points
ID: 1223557
Evijay is right. You will have to create a new filechooser in order to
specify that you want to get a directory instead of opening it.

Swing now comes with a much more robust file chooser dialog. You can
check it out here:

http://java.sun.com/products/jfc/tsc/swingdoc-current/file_chooser.html#

You should be able to find what you need at this page.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question