Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser list of roots/directories  RSS feed

 
Stan Sharpe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does one control the list of roots/directires in the pulldown at the top of the JFileChooser ?
I want to limit the user to a specific list of directories.
 
Angela Lamb
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried using a FileFilter? I know that will work for the directories in the chooser, maybe it will also apply to the directories in the drop-down box.
 
Stan Sharpe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried the FileFilter but that appears to only apply to what is in the "file" box. I couldn't find anything related to "list of directories" that would fill in the pulldown.
 
Vlad Patryshev
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sure I am horribly late, but the answer is: setFileSystemView(); you have to write your own FileSystemView, getRoots() of which returns the drives you want to return.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!