public void init(DefaultMutableTreeNode top) {
        layerFeatures = new Hashtable();
        // Create a tree that allows one selection at a time.
        final JTree tree = new JTree(top);
        tree.getSelectionModel()
                .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        tree.setVisibleRowCount(10);
        // Listen for when the selection changes.
        tree.addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
                if (node == null)
                    return;
                Object nodeInfo = node.getUserObject();
                if (node.isLeaf() && nodeInfo instanceof FeatureInfo) {
                    currentFeature = node;
                    // enable addToLayer button here.
                    addFeatureButton.setEnabled(true);
                } else {
                    // disable addToLayer button here.
                    addFeatureButton.setEnabled(false);
                }
            }
        });
        if (playWithLineStyle) {
            tree.putClientProperty("JTree.lineStyle", lineStyle);
        }
        // Create the scroll pane and add the tree to it.
        GridBagLayout outergridbag = new GridBagLayout();
        GridBagConstraints outerc = new GridBagConstraints();