It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes JFileChooser options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFileChooser options" Watch "JFileChooser options" New topic

JFileChooser options

Pres Brawner
Ranch Hand

Joined: Jan 18, 2001
Posts: 92
JFileChooser does some cool stuff. However, I don't need all of the behaviors that come as default.
It is possible to pick and choose what you get?
I just want to look at directories.
I don't want to see things in list or details format.
Since I am just dealing with directories, I want to change the text that talks about File and refer to Directory.
Thanks all,
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Pres,
There is a mode available in JFileChooser to let you specify if a user can select a file, directory, or both. I think you can use that to perform what you want.

Joined: May 18, 2001
Posts: 3
Use setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) for instance of your file chooser dialog... and get ur expected result...
Ritesh Basatwar
Pres Brawner
Ranch Hand

Joined: Jan 18, 2001
Posts: 92
Thanks for the helpful advice.
The thing about the Directories only is great!
However, I still need to change the text of the automatic messages (so I can internationalize them)
I don't want to see the "Display as List" icon
I don't want to see the "Display Details" icon
I don't wnat to see the "Files of type" label or input box.
Should I try to subclass?
I agree. Here's the link:
subject: JFileChooser options
It's not a secret anymore!