Loading the tree

It's fairly easy to create a tree and fill it with data:
  1. Create a tree node. We use standard Swing classes for our model and our nodes, so it's a DefaultMutableTreeNode.
  2. Create a model (it's a DefaultTreeModel), passing in the first node, which becomes the root of the tree.
  3. Create more nodes and attach them to the model by making them children of the root or of other nodes already in the model.
  4. Instantiate a Swing or dbSwing tree and set its model property to your model.

When you write code to do this, you quickly encounter the issues discussed in our user data object topic. We mention several here. See the comments in TreeModelMaker.java for more information.