📄 e900. displaying the current directory in the title of a jfilechooser dialog.txt
字号:
This example displays the complete path of the current directory in the title whenever the current directory changes.
final JFileChooser chooser = new JFileChooser();
// Initialize title with current directory
File curDir = chooser.getCurrentDirectory();
chooser.setDialogTitle(""+curDir.getAbsolutePath());
// Add listener on chooser to detect changes to current directory
chooser.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
File curDir = chooser.getCurrentDirectory();
chooser.setDialogTitle(""+curDir.getAbsolutePath());
}
}
}) ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -