0

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?

aditya_gaur
  • 3,209
  • 6
  • 32
  • 43

1 Answers1

2

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

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255