The working of model.insertNodeInto() function

1.3k views Asked by At

I have a little confusion: Is the function insertNodeInto used to inserts only a single node and not its sub nodes? for example I have a code snippet as follows:

DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("topMost");
newNode.add(new DefaultMutableTreeNode("A node"));
newNode.add(new DefaultMutableTreeNode("B node"));
model.insertNodeInto(newNode,rootNode,0);

So will the above code add all the 3 nodes to the tree or just the topMost node?

1

There are 1 answers

0
JB Nizet On BEST ANSWER

The node, with all its children, is inserted in the model, as a simple test would have shown.