📄 e891. getting and setting the current directory of a jfilechooser dialog.txt
字号:
JFileChooser chooser = new JFileChooser();
try {
// Create a File object containing the canonical path of the
// desired directory
File f = new File(new File(".").getCanonicalPath());
// Set the current directory
chooser.setCurrentDirectory(f);
} catch (IOException e) {
}
// The following method call sets the current directory to the home directory
chooser.setCurrentDirectory(null);
// Show the dialog; wait until dialog is closed
chooser.showOpenDialog(frame);
// Get the current directory
File curDir = chooser.getCurrentDirectory();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -