Code
tree.setCellEditor(new DefaultTreeCellEditor(
tree, (DefaultTreeCellRenderer)tree.getCellRenderer()) {
@Override public boolean isCellEditable(java.util.EventObject e) {
return (e instanceof MouseEvent)?false:super.isCellEditable(e);
}
});
tree.setEditable(true);
tree.setComponentPopupMenu(new TreePopupMenu());