⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e900. displaying the current directory in the title of a jfilechooser dialog.txt

📁 这里面包含了一百多个JAVA源文件
💻 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 + -