If I understand you correctly, you need to use the setSelectedFile
method.
JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setSelectedFile(new File("fileToSave.txt"));
jFileChooser.showSaveDialog(parent);
The file doesn't need to exist.
If you pass a File with an absolute path, JFileChooser
will try to position itself in that directory (if it exists).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…