package cl.jtv;
/*
 * MyTreeModelListener.java
 *
 * Created on 26 de julio de 2002, 03:06 AM
 */

/**
 *
 * @author  Administrador
 * @version 
 */
import javax.swing.*;
import java.awt.*;
import java.util.*;
import javax.swing.tree.*;

class MyTreeModelListener implements javax.swing.event.TreeModelListener {
        public void treeNodesChanged(javax.swing.event.TreeModelEvent e) {
            DefaultMutableTreeNode node;
            node = (DefaultMutableTreeNode)
                     (e.getTreePath().getLastPathComponent());

            /*
             * If the event lists children, then the changed
             * node is the child of the node we've already
             * gotten.  Otherwise, the changed node and the
             * specified node are the same.
             */
            try {
                int index = e.getChildIndices()[0];
                node = (DefaultMutableTreeNode)
                       (node.getChildAt(index));
            } catch (NullPointerException exc) {}

            System.out.println("The user has finished editing the node.");
            System.out.println("New value: " + node.getUserObject());
        }
        public void treeNodesInserted(javax.swing.event.TreeModelEvent e) {
        }
        public void treeNodesRemoved(javax.swing.event.TreeModelEvent e) {
        }
        public void treeStructureChanged(javax.swing.event.TreeModelEvent e) {
        }
        
 }
