An Animated 2D Cone Tree is displayed in a series of cone (or star) shapes where the children on any node are displayed in a cone round the parent.
We can display a large tree on one screen using this type of display but at the expense of node information. For a very large tree, the information ‘lower’ down the tree tends to become hidden behind nodes ‘higher’ in the tree. The initial display contains the root node at the centre of the display. Left clicking on any node will result in that node being placed at the centre of the display. Successively doing this results in the lower nodes becoming more visible and the higher ones less visible.
The flow of the tree is determined by following nodes in a clockwise direction round the parent. When starting at the root, the first is that located at the North West subordinate node. When starting at a subordinate node, the first is that located, in a clockwise direction, from the line joining the subordinate node to its parent.
The display can be enhanced by using a tree node which extends ACNode and overrides the ACNode methods.
The initial display contains no node information as this clutters up the panel. As the mouse pointer moves over a node, the node name is displayed. Right clicking on a node causes a pop-up menu to be displayed giving the user the option to hold the node name or release a name currently being held.
Further node manipulation can be made by using a pop-up menu which is activated by right clicking on a space containing no node:
| Source Module | Description |
| ACNode | class to represent an A2D node - extends DefaultMutableTreeNode |
| ACTreeTest | Main test harness class - creates new Frame1 |
| Frame1 | Main frame to test tree - contains menu items for creating random trees - extends JFrame |
| TreePanel | Panel used to display the tree defined by ACNodes - extends JPanel |
ACTreeTest and Frame1 are harness classes merely to demonstrate the
functionality of ACNode and TreePanel.
ACNode and TreePanel can be incorporated in any program which requires
an Animated 2D Cone Tree alternative to a JTree.
// create new A2D Cone
Tree Display from tree.
// GuruEnquiryListItem
extends ACNode.
GuruEnquiryListItem
x = gtmd.getRootNode ();
TreePanel treep = new
TreePanel ( x );
// create a new tab,
add tree display to it and make it selected
resultsTP.addTab ( (title
+ "*"), treep );
int tabIndex = (resultsTP.getTabCount
()) - 1;
resultsTP.setSelectedIndex
( tabIndex );
To incorporate the tree into your java program, follow your nose!