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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With