I want to find a method like isNodeExpanded() to check 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?
I want to find a method like isNodeExpanded() to check 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
.