This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFileChooser" Watch "JFileChooser" New topic
Author

JFileChooser

Jude Fawly
Ranch Hand

Joined: Dec 01, 2004
Posts: 33
hi,

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

thanks.


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
Sheriff

Joined: Oct 14, 2005
Posts: 19725
    
  10

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: http://aspose.com/file-tools
 
subject: JFileChooser
 
jQuery in Action, 3rd edition