jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes JFileChooser:file name field becomes blank 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:file name field becomes blank" Watch "JFileChooser:file name field becomes blank" New topic

JFileChooser:file name field becomes blank

Amol Fuke
Ranch Hand

Joined: Apr 08, 2005
Posts: 129
Hi All,

I have one problem with JFileChooser.

When I click on save of my frame ,JFileChooser dialog opens with default file name that I have generated and the default folder location is the folder of my Emp id.(I dont know how this is coming?).Problem is when I select any directory other than the my emp id directory and on clicking save button,file name field becomes blank and the dialog box remains on the screen.

Please help.

"There are no mistakes, only lessons"
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Are any exceptions being thrown? If you run your application from the command line they should appear there.
Amol Fuke
Ranch Hand

Joined: Apr 08, 2005
Posts: 129
Thanks Anyway.

The problem has been solved.I have to overwrite two methods setSelectedFile() and getSelectedFile() in my code.
Guido Sautter
Ranch Hand

Joined: Dec 22, 2004
Posts: 142
Hi Amon,

I just ran into the same problem of the file name becoming blank when the file filter is changed. With what did you overwrite the setSelectedFile() method to solve the problem?

Thanks for advice,

I agree. Here's the link: http://aspose.com/file-tools
subject: JFileChooser:file name field becomes blank
It's not a secret anymore!