Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFileChooser opendialog question

 
y xu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When I use showOpenDialog, how I can disable the "create new folder" icon in the filechoose. I can not figure out how to change property related with this opendialog.

Thanks.

-y
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The new folder button is created, configured and added to the JFileChooser in the installComponents method of the javax.swing.plaf.metal.MetalFileChooserUI class for the default LookAndFeel. You can remove the button with this
 
jefff willis
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you get it enabled to begin with?
(mine always show up disabled)

Anyway, here is a HACK (notice the capital letters indicating that not self respecting developer would actually use this approach in thier application)




This works, but there must be a better way to do this.
 
y xu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all.

It works using Jefff's HACK. Not Craig's. I am still trying to use Craig's self respecting way.

Thanks.

-y
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you put the property before instantiating the JFileChooser.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic