Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes JFileChooser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFileChooser" Watch "JFileChooser" New topic


Jude Fawly
Ranch Hand

Joined: Dec 01, 2004
Posts: 33

how can i limit the jfilechooser to search only in a specific folder nothing more?


Teach me to die that so I may<br />Rise glorious at the awful day
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you can hide/disable the navigation buttons and the combobox, but subfolders
will show.

might be easier to use a JList populated with listFiles() filtered by isFile()
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Have you tried providing it with a FileFilter that only accepts files (not subdirectories) in that directory?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Hi Doc,

yep, that works - didn't even cross my mind (a short trip!)
I agree. Here's the link:
subject: JFileChooser
Similar Threads
File browser crash course
Folder Selector
Simple file browser !!!!!!
Is there any Browse button control in Swing ??
how to write coding for browse button in java swing?