提交 84ada1f4 编写于 作者: A alexsch

8000969: [macosx] Directories are not deselected when JFileChooser has FILES_ONLY selection mode

Reviewed-by: rupashka
上级 4dea4ee4
...@@ -379,6 +379,19 @@ public class AquaFileChooserUI extends FileChooserUI { ...@@ -379,6 +379,19 @@ public class AquaFileChooserUI extends FileChooserUI {
} }
} }
updateButtonState(getFileChooser()); updateButtonState(getFileChooser());
} else if (prop.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) {
JFileChooser fileChooser = getFileChooser();
if (!fileChooser.isDirectorySelectionEnabled()) {
final File[] files = (File[]) e.getNewValue();
if (files != null) {
for (int selectedRow : fFileList.getSelectedRows()) {
File file = (File) fFileList.getValueAt(selectedRow, 0);
if (fileChooser.isTraversable(file)) {
fFileList.removeSelectedIndex(selectedRow);
}
}
}
}
} else if (prop.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) { } else if (prop.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) {
fFileList.clearSelection(); fFileList.clearSelection();
final File currentDirectory = getFileChooser().getCurrentDirectory(); final File currentDirectory = getFileChooser().getCurrentDirectory();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册