File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Murach's Java Servlets and JSP this week in the Servlets 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
 
Don't get me started about those stupid light bulbs.
 
subject: Putting a Default Name to file Using JFileChooser
 
Similar Threads
JFileChooser:file name field becomes blank
Network file in JFiLechooser
Jfilechooser problem
saving a text file using JFileChooser
problem in creating directory using JFileChooser(code included)