本文整理匯總了Java中javax.swing.JFileChooser.isDirectorySelectionEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java JFileChooser.isDirectorySelectionEnabled方法的具體用法?Java JFileChooser.isDirectorySelectionEnabled怎麽用?Java JFileChooser.isDirectorySelectionEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.isDirectorySelectionEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doDirectoryChanged
import javax.swing.JFileChooser; //導入方法依賴的package包/類
private void doDirectoryChanged(PropertyChangeEvent e) {
JFileChooser fc = getFileChooser();
FileSystemView fsv = fc.getFileSystemView();
clearIconCache();
File currentDirectory = fc.getCurrentDirectory();
this.fileList.updatePath(currentDirectory);
if (currentDirectory != null) {
this.directoryComboBoxModel.addItem(currentDirectory);
getNewFolderAction().setEnabled(currentDirectory.canWrite());
getChangeToParentDirectoryAction().setEnabled(!fsv.isRoot(currentDirectory));
getChangeToParentDirectoryAction().setEnabled(!fsv.isRoot(currentDirectory));
getGoHomeAction().setEnabled(!userHomeDirectory.equals(currentDirectory));
if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) {
if (fsv.isFileSystem(currentDirectory)) {
setFileName(currentDirectory.getPath());
} else {
setFileName(null);
}
setFileSelected();
}
}
}
示例2: fileNameString
import javax.swing.JFileChooser; //導入方法依賴的package包/類
private String fileNameString(File file) {
if (file == null) {
return null;
} else {
JFileChooser fc = getFileChooser();
if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) {
return file.getPath();
} else {
return file.getName();
}
}
}
示例3: doSelectedFileChanged
import javax.swing.JFileChooser; //導入方法依賴的package包/類
private void doSelectedFileChanged(PropertyChangeEvent e) {
File f = (File) e.getNewValue();
JFileChooser fc = getFileChooser();
if (f != null && (fc.isFileSelectionEnabled() && !f.isDirectory()
|| f.isDirectory() && fc.isDirectorySelectionEnabled())) {
setFileName(fileNameString(f));
setFileSelected();
}
}
示例4: doSelectedFilesChanged
import javax.swing.JFileChooser; //導入方法依賴的package包/類
private void doSelectedFilesChanged(PropertyChangeEvent e) {
File[] files = (File[]) e.getNewValue();
JFileChooser fc = getFileChooser();
if (files != null && files.length > 0
&& (files.length > 1 || fc.isDirectorySelectionEnabled() || !files[0].isDirectory())) {
setFileName(fileNameString(files));
} else {
setFileName("");
}
setFileSelected();
}
示例5: doFileSelectionModeChanged
import javax.swing.JFileChooser; //導入方法依賴的package包/類
private void doFileSelectionModeChanged(PropertyChangeEvent e) {
doFilterChanged(e);
JFileChooser fc = getFileChooser();
File currentDirectory = fc.getCurrentDirectory();
if (currentDirectory != null && fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()
&& fc.getFileSystemView().isFileSystem(currentDirectory)) {
setFileName(currentDirectory.getPath());
} else {
setFileName(null);
}
setFileSelected();
}