use*_*719 1 java swing filedialog
我有两个按钮都打开filedialog我想要的两个按钮应该总是打开他们相关的目录在filedialog当他们按下.在我的情况下filedialog保持最后打开目录,我不想要.
你没有命名使用过的框架,但假设它是Swing,JFileChooser有一些允许设置初始路径的构造函数:
JFileChooser(File currentDirectory)
Constructs a JFileChooser using the given File as the path.
Run Code Online (Sandbox Code Playgroud)
对于FileDialogAWT框架,在显示对话框之前使用setter设置目录
setDirectory(String dir)
Sets the directory of this file dialog window to be the specified directory.
Run Code Online (Sandbox Code Playgroud)