public class JTreeUIUtilities
extends java.lang.Object
构造器和说明 |
---|
JTreeUIUtilities() |
限定符和类型 | 方法和说明 |
---|---|
static void |
expandPath(javax.swing.JTree tree, javax.swing.tree.TreePath treePath, boolean expand)
展开树指定节点
|
static void |
expandTree(javax.swing.JTree tree, boolean expand)
展开树所有节点
|
static javax.swing.tree.TreePath |
getPath(javax.swing.tree.TreeNode treeNode)
已过时。
不需要这样子获取,直接new TreePath(((DefaultMutableTreeNode)treeNode).getPath());
|
static void |
initTreeBehave(javax.swing.JTree tree)
隐藏根节点并且显示根节点的
|
static void |
locateNode(javax.swing.JTree jTree, javax.swing.tree.DefaultMutableTreeNode node)
定位到树指定节点并选中
|
static void |
locateNode(javax.swing.JTree jTree, javax.swing.tree.TreePath treePath)
定位到树指定节点并选中
|
static void |
selectRowAtPoint(javax.swing.JTree tree, int x, int y)
根据坐标设置树选中
|
public static void locateNode(javax.swing.JTree jTree, javax.swing.tree.DefaultMutableTreeNode node)
jTree
- 树对象node
- 要定位的节点public static void locateNode(javax.swing.JTree jTree, javax.swing.tree.TreePath treePath)
jTree
- 树对象treePath
- 要定位的节点 treePathpublic static void expandTree(javax.swing.JTree tree, boolean expand)
tree
- 指定树对象expand
- 是否展开public static void expandPath(javax.swing.JTree tree, javax.swing.tree.TreePath treePath, boolean expand)
tree
- 指定树对象treePath
- 指定树节点地址expand
- 是否展开public static javax.swing.tree.TreePath getPath(javax.swing.tree.TreeNode treeNode)
treeNode
- 指定树节点public static void selectRowAtPoint(javax.swing.JTree tree, int x, int y)
tree
- 树对象x
- 鼠标x坐标y
- 鼠标y坐标public static void initTreeBehave(javax.swing.JTree tree)
tree
- 需要设置的树