This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Putting a Default Name to file Using JFileChooser  RSS feed

 
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!