Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFileChooser

 
Jude Fawly
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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

thanks.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried providing it with a FileFilter that only accepts files (not subdirectories) in that directory?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Doc,

yep, that works - didn't even cross my mind (a short trip!)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic