本文整理了Java中javax.swing.JTree.setSelectionInterval()
方法的一些代码示例,展示了JTree.setSelectionInterval()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.setSelectionInterval()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:setSelectionInterval
暂无
代码示例来源:origin: triplea-game/triplea
private void previous() {
if (tree.getSelectionCount() == 0) {
tree.setSelectionInterval(0, 0);
return;
}
final TreePath path = tree.getSelectionPath();
final TreeNode selected = (TreeNode) path.getLastPathComponent();
@SuppressWarnings("unchecked")
final Enumeration<TreeNode> nodeEnum =
((DefaultMutableTreeNode) tree.getModel().getRoot()).depthFirstEnumeration();
TreeNode previous = null;
while (nodeEnum.hasMoreElements()) {
final TreeNode current = nodeEnum.nextElement();
if (current == selected) {
break;
} else if (current.getParent() instanceof Step) {
previous = current;
}
}
if (previous != null) {
navigateTo(previous);
}
}
代码示例来源:origin: triplea-game/triplea
private void next() {
if (tree.getSelectionCount() == 0) {
tree.setSelectionInterval(0, 0);
return;
}
final TreePath path = tree.getSelectionPath();
final TreeNode selected = (TreeNode) path.getLastPathComponent();
@SuppressWarnings("unchecked")
final Enumeration<TreeNode> nodeEnum = ((DefaultMutableTreeNode) tree.getModel().getRoot()).preorderEnumeration();
TreeNode next = null;
boolean foundSelected = false;
while (nodeEnum.hasMoreElements()) {
final TreeNode current = nodeEnum.nextElement();
if (current == selected) {
foundSelected = true;
} else if (foundSelected) {
if (current.getParent() instanceof Step) {
next = current;
break;
}
}
}
if (next != null) {
navigateTo(next);
}
}
代码示例来源:origin: net.sf.ingenias/ingeniasjgraphmod
tree.setSelectionInterval(0, 0);
内容来源于网络,如有侵权,请联系作者删除!