e900. displaying the current directory in the title of a jfilechooser dialog.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 19 行
TXT
19 行
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 + =
减小字号Ctrl + -
显示快捷键?