Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Putting a Default Name to file Using JFileChooser

 
Mohammed Ajmal
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic