Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser question  RSS feed

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

how can i disable the navigation button and the home directory buttons on a JFileChooser? I want my jfilechooser to search only in the directory i specified only without allowing the user to go on level higher in the folders tree, or to go to the parent directry, or be able to choose another directory from the combobox?
is it possible? how can i do that?

thanks.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's possible to disable those buttons, but you can use the FileFilter concept to restrict which files are shown in the dialog. It's usually used to show only certain file types, but might as well only display files in a particular directory. The Swing Tutorial has a chapter on JFileChooser which explains this.
[ November 06, 2005: Message edited by: Ulf Dittmer ]
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you might need to bite the bullet and implement your own file chooser UI.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to break into the plaf code but didn't have any success. There's a note at the top of MetalFileChooserUI that says the designers are going to do a complete rewrite soon so everything is marked 'private'. So I dropped back to an old friend: going through the component hierarchy.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!