File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Double Duty FileChooser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Double Duty FileChooser" Watch "Double Duty FileChooser" New topic
Author

Double Duty FileChooser

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

I have a FileChooser with FileFilter for one task and for a second task I remove the Filter, but what I have is the last file name selected int the FileChooser which I have tried to remove when switching to the other use of the FileChooser


Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> but what I have is the last file name selected int the FileChooser which I have tried to remove when switching...

when you switch, include this line
fileChooser.setSelectedFile(new File(""));
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4638
    
    5

Michael Dunn wrote:when you switch, include this line
fileChooser.setSelectedFile(new File(""));

So long as the file selection mode isn't DIRECTORIES_ONLY
Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

Thank you Michael Dunn. This works below.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Double Duty FileChooser