This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark ""Details View" in JFileChooser" Watch ""Details View" in JFileChooser" New topic

"Details View" in JFileChooser

Prashant Sehgal
Ranch Hand

Joined: Jun 20, 2003
Posts: 56
When I load my JFileChooser, I want the file listing inside it to default to the "Details View" rather than the "List View".
How do I do that? I know that I have to approach this using the FileChooserUI class...but I couldn't find any methods that let me access the "Details View" and the "List View" buttons.
So how do I do it ?
Prashant Sehgal
Ranch Hand

Joined: Jun 20, 2003
Posts: 56
Anyone :roll: ??
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Unfortunately, it is hardcoded into MetalFileChooserUI for the list view panel to be the default, and anything that can affect this is defined as private. There are some comments in the code that say this code is defined as private because it may change soon, so hopefully they will make it more modifiable when they change it. Looks like you are out of luck for now though...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Prashant Sehgal
Ranch Hand

Joined: Jun 20, 2003
Posts: 56
Arrghh !
I feared that this would be the case. Thanks Nathan for confirming my doubt. While scouring through the API I also ran into the class and was hoping that some implementation of this somewhere would also allow the JFileChooser's view to be set to a JTable instead of a JList...but didn't find anything like that !
Anyway, thanks again.
I agree. Here's the link:
subject: "Details View" in JFileChooser
It's not a secret anymore!