【问题标题】:JFileChooser Save Dialog Suggest File Name [duplicate]JFileChooser保存对话框建议文件名[重复]
【发布时间】:2012-12-22 12:38:35
【问题描述】:

可能重复:
JFileChooser.showSaveDialog(…) - how to set suggested file name

我已经看到这个问题被问了几次,但没有一个答案对我有任何帮助。我希望保存对话框使用 JFileChooser 建议类似“myFile.txt”的文件名。

这是我所拥有的:

JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setCurrentDirectory(new File("C:\\"));
jFileChooser.showSaveDialog(null);

【问题讨论】:

标签: java swing filenames jfilechooser savefiledialog


【解决方案1】:

这样就可以了:

jFileChooser.setSelectedFile(new File(optionalPath + "myFile.txt"));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-02-24
    • 1970-01-01
    • 2012-02-09
    • 1970-01-01
    • 2013-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多