我想找到一个像 isNodeExpanded() 这样的方法来检查给定的 JTree 节点是否被扩展,但我找不到它。
我知道我可以通过使用 TreeExpansionListener 跟踪节点扩展来做到这一点。有没有更好的办法?
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);
漂亮,JavaDoc :-)
Node 的展开状态不是在 中,TreeModel
而是在 中JTree
。