by Dinesh Thakur

 

import java.awt.*;

import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class JavaExampleTreeEditInJApplet extends JApplet implements CellEditorListener
{
    public void init()
     {
        JTree Tree = new JTree();
        getContentPane().add(Tree);
        Tree.setEditable(true);
        Tree.getCellEditor().addCellEditorListener(this);
    }
          public void editingCanceled(ChangeEvent e1)
           {
               CellEditor ClEdtr = (CellEditor)e1.getSource();
               showStatus("Change Not Done");
           }
               public void editingStopped(ChangeEvent e2)
              {
                  CellEditor ClEdtr = (CellEditor)e2.getSource();
                  showStatus("New Text: " + (String)ClEdtr.getCellEditorValue());
              }
}
/*<APPLET CODE=JavaExampleTreeEditInJApplet.class WIDTH=350 HEIGHT=280> </APPLET>*/ 
Java JTree Cell Editor Example