[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Select a directory in a FileDialog?

Posted on 1998-09-03
2
Medium Priority
?
2,062 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

649 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