This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Double Duty FileChooser Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Double Duty FileChooser" Watch "Double Duty FileChooser" New topic
Author

Double Duty FileChooser

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 179

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: 4165
    
    3

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: 179

Thank you Michael Dunn. This works below.


 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Double Duty FileChooser
 
Similar Threads
JFileChooser to save file
JFileChooser problem . jar
JFileChooser problem
problem on reading the content of a file which has been uploaded in a remote ftp server
Disabling and Enabling Up One level button and new folder button in JFileChooser on some condition