![]() |
|
|
|||||||
![]() |
Java - [JTree] Adding a leaf to a node |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hi I'm working with JTree and I need to know
how to add to a specifique node a leaf. My tree will represent a contact list and all the nodes are groups. And I would like to add to a particular groups an user. I began to try something like that : public void addUsers (String userName , String group, String statut) { for (int i = 0; i < rootNode.getChildCount();i++) { if (rootNode.getChildAt(i).toString() == group) { DefaultMutableTreeNode leaf = new DefaultMutableTreeNode(userName + " " + statut); // And here I would like to add to the node at [i] a new leaf } } } Thanks for your help. Alexandre Jaquet |
|
|