aspose file tools*
The moose likes Java in General and the fly likes Putting a Default Name to file Using JFileChooser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Putting a Default Name to file Using JFileChooser" Watch "Putting a Default Name to file Using JFileChooser" New topic
Author

Putting a Default Name to file Using JFileChooser

Mohammed Ajmal
Greenhorn

Joined: Sep 20, 2004
Posts: 29
Hi,

I am using JFileChooser for saving the contents to a file. Here my problem is to give some name by default to a file. So the user need not give any problem. He has to just click save. The file name is combination of some id date and time.

Can somebody guide me in proceeding for the same if it is possible.

Thanks,
Ajmal
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Why use the JFileChooser ? If you don't want the user to control the naming and placement of stored files, just provide the user with a save button and write the file to disk using your criteria.
Mohammed Ajmal
Greenhorn

Joined: Sep 20, 2004
Posts: 29
Hi,

We can set the default filename for JFileChooser save dialog using the property called setSelectedFile(filename),and it is displayed under filename text box.

Thanks,
Ajmal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Putting a Default Name to file Using JFileChooser