I am using a JFileChooser
and the showSaveDialoge()
and setSelectionMode(JfileChooser.DIRECTORIES_ONLY)
to set where a preselected file will be saved and what it will be called.
I want the user to be able to choose the name the new version, and where to put it. How do I go about this? I also wish to choose a default name.
I hope the codes below implemented inline with your question requirements. The criteria in your question are answered in the code comment. If you need clarification, please let me know.
Extend the Dialog and add your required components like an entry for version( JComboBox) , default File name field (JTextField) where you set the default name and on pressing Ok , fetch all the components selected values and then save your required.
Yes, this can be done. Apparently you need to use a property change listener to set the default file-name after each directory change. You will also want to make sure you are using showSaveDialog() and turn off directory only selection mode (you want them to pick a filename in a particular path)
Here is some code about the property change listener part:
This code is from the example here: http://www.codeguru.com/forum/archive/index.php/t-38894.html