/ / Existe-t-il un meilleur moyen de tester le noeud JTree développé ou non? - java, balançoire, jtree

Existe-t-il un meilleur moyen de tester le noeud JTree développé ou non? - java, balançoire, jtree

Je veux trouver une méthode comme isNodeExpanded () pour vérifier si un noeud JTree donné est développé ou non, mais je ne le trouve pas.

Je sais que je peux le faire en suivant l'évolution du noeud avec TreeExpansionListener. Y a-t-il un meilleur moyen?

Réponses:

13 pour la réponse № 1

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);

Beau, JavaDoc :-)

L'état développé d'un nœud est ne pas dans le TreeModel mais dans le JTree.