// Copyright MageLang Institute; Version $Id: //depot/main/src/edu/modules/Swing/magercises/TreeExample/TreeExample.java#2 $ /* * Demonstrates tree view stuff in a scrollable pane. */ import javax.swing.*; import java.awt.*; import java.awt.event.*; // Import tree package // Create class that implements TreeSelectionListener public class TreeExample extends JFrame { // The initial width and height of the frame static int WIDTH = 300; static int HEIGHT = 200; public TreeExample(String lab) { super(lab); // Create the tree nodes // Group the nodes // Create the TreeSelectionListener // Create the TreePanel // Add panel to frame } public static void main(String s[]) { TreeExample frame = new TreeExample("Tree Example"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); frame.setSize(WIDTH, HEIGHT); frame.setVisible(true); } }