javax.swing.JFileChooser#isDirectorySelectionEnabled ( )源码实例Demo

下面列出了javax.swing.JFileChooser#isDirectorySelectionEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: rapidminer-studio   文件: FileChooserUI.java
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();
		}
	}
}
 
源代码2 项目: rapidminer-studio   文件: FileChooserUI.java
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();
	}
}
 
源代码3 项目: rapidminer-studio   文件: FileChooserUI.java
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();
}
 
源代码4 项目: rapidminer-studio   文件: FileChooserUI.java
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()) {
			if (fc.isFileSelectionEnabled()) {
				setFileName(null);
			} else {
				if (fsv.isFileSystem(currentDirectory)) {
					setFileName(currentDirectory.getPath());
				} else {
					setFileName(null);
				}
			}
			setFileSelected();
		}
	}
}
 
源代码5 项目: rapidminer-studio   文件: FileChooserUI.java
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();
}