editingPath = path; editingRow = tree.getRowForPath(editingPath);
if (size.width != bounds.width || size.height != bounds.height) { editorHasDifferentSize = true; treeState.invalidatePathBounds(path); updateSize(); } else editorHasDifferentSize = false;
  protected boolean startEditing(TreePath path, MouseEvent event)  {    updateCellEditor();    TreeCellEditor ed = getCellEditor();    if (ed != null && (event == EDIT || ed.shouldSelectCell(event))        && ed.isCellEditable(event))      {        Rectangle bounds = getPathBounds(tree, path);        // Extend the right boundary till the tree width.        bounds.width = tree.getWidth() - bounds.x;        editingPath = path;        editingRow = tree.getRowForPath(editingPath);        Object value = editingPath.getLastPathComponent();        stopEditingInCompleteEditing = false;        boolean expanded = tree.isExpanded(editingPath);        isEditing = true;        editingComponent = ed.getTreeCellEditorComponent(tree, value, true,                                                         expanded,                                                         isLeaf(editingRow),                                                         editingRow);                // Remove all previous components (if still present). Only one        // container with the editing component inside is allowed in the tree.        tree.removeAll();        // The editing component must be added to its container. We add the        // container, not the editing component itself.        Component container = editingComponent.getParent();        container.setBounds(bounds);        tree.add(container);        editingComponent.requestFocus();        return true;      }    return false;  }