/ / Чи є кращий спосіб перевірити розширений вузол JTree чи ні? - java, гойдалка, jtree

Чи існує кращий спосіб перевірки вузла JTree розширеного чи ні? - java, swing, jtree

Я хочу знайти такий метод, як isNodeExpanded (), щоб перевірити, чи розширений даний вузол JTree чи ні, але я не можу його знайти.

Я знаю, що можу це зробити, відстежуючи розширення вузла за допомогою TreeExpansionListener. Чи є кращий спосіб?

Відповіді:

13 за відповідь № 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);

Красиво, JavaDoc :-)

Розширений стан Вузла є ні в TreeModel але в JTree.