我如何在 JFileChooser 中添加选定的文件历史记录

How I can add selected files history in JFileChooser

谁能帮助我了解如何在 JFileChooser 中保存选定文件的历史记录,并使用组合框将其显示在定位文件名的字段中。 谢谢。

Swing JFileChooser 有一个方法可以在按下按钮时使用方法 setCurrentDirectory(File dir)

设置初始目录

您始终可以使用 getCurrentDirectory() 检索上次访问文件的位置。然后您可以将它保存在某个变量或某个配置文件中,然后在启用文件选择器时检索它...

另请参阅Is there any way to make java file selection dialogs remember the last directory?了解更多信息