aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JFileChooser opendialog question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFileChooser opendialog question" Watch "JFileChooser opendialog question" New topic
Author

JFileChooser opendialog question

y xu
Greenhorn

Joined: Dec 09, 2004
Posts: 3
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

Joined: Jan 14, 2004
Posts: 1535
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

Joined: Sep 29, 2004
Posts: 113
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

Joined: Dec 09, 2004
Posts: 3
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

Joined: Jan 14, 2004
Posts: 1535
Make sure you put the property before instantiating the JFileChooser.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFileChooser opendialog question
 
Similar Threads
Problem with JFileChooser Create New Folder when Program Files folder is selected.
Java Script in JSP page
JFileChooser
Display a file in Notepad
In JFileDialog how to use the save window