本文整理了Java中javax.swing.JTree.removeSelectionPath()
方法的一些代码示例,展示了JTree.removeSelectionPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.removeSelectionPath()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:removeSelectionPath
暂无
代码示例来源:origin: UISpec4J/UISpec4J
/**
* Removes the given node from the current jTree selection.
*/
public void removeFromSelection(String path) {
TreePath jTreePath = getTreePath(path);
jTree.removeSelectionPath(jTreePath);
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime
@Override
public void removeSelectionPath(TreePath path) {
getUI().removeSelectionPath(path);
}
代码示例来源:origin: sdedit/sdedit
public void deselectAll() {
if (tree.getSelectionPaths() != null) {
for (TreePath path : tree.getSelectionPaths()) {
tree.removeSelectionPath(path);
}
}
}
代码示例来源:origin: sdedit/sdedit
public int deselectDescendants(TreePath selectedNode) {
int n = 0;
Object node = selectedNode.getLastPathComponent();
if (tree.getSelectionPaths() != null) {
for (TreePath selection : tree.getSelectionPaths()) {
Object current = selection.getLastPathComponent();
if (current != node) {
IdentityHashMap<Object, Object> ancestors = new IdentityHashMap<Object, Object>();
for (Object obj : selection.getPath()) {
ancestors.put(obj, obj);
}
if (ancestors.containsKey(node)) {
tree.removeSelectionPath(selectedNode);
n++;
}
}
}
}
return n;
}
代码示例来源:origin: sdedit/sdedit
public int deselectAncestors(TreePath selectedNode) {
IdentityHashMap<Object, Object> ancestors = new IdentityHashMap<Object, Object>();
Object[] path = selectedNode.getPath();
int n = 0;
if (tree.getSelectionPaths() != null) {
for (int i = 0; i < path.length - 1; i++) {
ancestors.put(path[i], path[i]);
}
for (TreePath selection : tree.getSelectionPaths()) {
if (ancestors.containsKey(selection.getLastPathComponent())) {
tree.removeSelectionPath(selection);
n++;
}
}
}
return n;
}
代码示例来源:origin: org.orbisgis/orbisgis-view
/**
* This method refresh the tree based on the names of the leaf.
* @param text
*/
public void filter(String text) {
this.filterText = text.toLowerCase();
TreePath[] selPaths = tree.getSelectionPaths();
if (selPaths != null) {
for (int i = 0; i < selPaths.length; i++) {
if (!isFiltered(selPaths[i].getLastPathComponent())) {
tree.removeSelectionPath(selPaths[i]);
}
}
}
fireEvent();
if (!isFiltered()) {
for (int i = 0; i < tree.getRowCount(); i++) {
tree.collapseRow(i);
}
} else {
for (int i = 0; i < tree.getRowCount(); i++) {
tree.expandRow(i);
}
}
}
代码示例来源:origin: orbisgis/orbisgis
/**
* This method refresh the tree based on the names of the leaf.
* @param text
*/
public void filter(String text) {
this.filterText = text.toLowerCase();
TreePath[] selPaths = tree.getSelectionPaths();
if (selPaths != null) {
for (int i = 0; i < selPaths.length; i++) {
if (!isFiltered(selPaths[i].getLastPathComponent())) {
tree.removeSelectionPath(selPaths[i]);
}
}
}
fireEvent();
if (!isFiltered()) {
for (int i = 0; i < tree.getRowCount(); i++) {
tree.collapseRow(i);
}
} else {
for (int i = 0; i < tree.getRowCount(); i++) {
tree.expandRow(i);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!