Point click = e.getPoint(); TreePath path = getClosestPathForLocation(tree, click.x, click.y);  if (path != null) { bounds = getPathBounds(tree, path); int row = getRowForPath(tree, path); boolean cntlClick = isLocationInExpandControl(path, click.x, click.y);  boolean isLeaf = isLeaf(row); if (isLeaf) bounds.width += rightChildIndent + gap; else if (hasControlIcons()) bounds.width += getCurrentControlIcon(path).getIconWidth() + gap;  boolean inBounds = bounds.contains(click.x, click.y); if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if (inBounds && e.getClickCount() == 2 && !isLeaf(row)) toggleExpandState(path);  if (cntlClick) { handleExpandControlClick(path, click.x, click.y); if (cellEditor != null) cellEditor.cancelCellEditing(); } else if (tree.isEditable()) startEditing(path, e); } }
    public void mousePressed(MouseEvent e)    {      Point click = e.getPoint();      TreePath path = getClosestPathForLocation(tree, click.x, click.y);      if (path != null)        {          bounds = getPathBounds(tree, path);          int row = getRowForPath(tree, path);          boolean cntlClick = isLocationInExpandControl(path, click.x, click.y);                    boolean isLeaf = isLeaf(row);          if (isLeaf)            bounds.width += rightChildIndent + gap;          else if (hasControlIcons())            bounds.width += getCurrentControlIcon(path).getIconWidth() + gap;          boolean inBounds = bounds.contains(click.x, click.y);          if ((inBounds || cntlClick) && tree.isVisible(path))            {              selectPath(tree, path);              if (inBounds && e.getClickCount() == 2 && !isLeaf(row))                  toggleExpandState(path);                            if (cntlClick)                {                  handleExpandControlClick(path, click.x, click.y);                  if (cellEditor != null)                    cellEditor.cancelCellEditing();                }              else if (tree.isEditable())                startEditing(path, e);            }        }    }