The Swing JTree

The data to be displayed is the contents of a Swing JTree. The example simply uses the contents of a default JTree, which contains names of various colors, sports and food. You create the JTree object as shown in the following code example.
TreeModel treeModel = new JTree().getModel();