Open JFileChooser with "Filename" field filled in

2

How can I open JFileChooser with the Filename field filled in?

This image field below:

How do I set a name to default to this field?

    
asked by anonymous 14.03.2016 / 13:03

1 answer

1

You need to use the method setSelectedFile

JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setSelectedFile(new File("fileToSave.txt"));
jFileChooser.showSaveDialog(parent);

Font

    
14.03.2016 / 13:09