The tree structure in TreeMenuApplet
is built in a
completely recursive manner. Each mode of the tree is composed of
two objects, a Tree
object, and a TreeNode
object.
The TreeNode
object is the visual representation
of the node, comprising the icon, the node label, and the widget
to the left of the node that allows expantion and contraction of
the node.
The Tree
object comprises the structure of the tree.
Each Tree
contains one TreeNode
(it's
root node) and any number of Tree
nodes comprising
it's children. It also has a reference to a parent tree (null if
there is no parent). Any operations that have to traverse the
tree do so recursively both upward and downward from the current
node.