开发者

Is there a better way to test JTree node expanded or not?

I want to find a method like isNodeExpanded() to chec开发者_开发技巧k if a given JTree node is expanded or not, but I can not find it.

I know I can do this by tracking the node expansion with the TreeExpansionListener. Is there a better way?


JTree.java:

 /**
 * Returns true if the node identified by the path is currently expanded,
 * 
 * @param path  the <code>TreePath</code> specifying the node to check
 * @return false if any of the nodes in the node's path are collapsed, 
 *               true if all nodes in the path are expanded
 */
public boolean isExpanded(TreePath path);

Beautiful, JavaDoc :-)

The expanded state of a Node is not in the TreeModel but in the JTree.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜