Point click = e.getPoint(); int row = Math.round(click.y / BasicTreeUI.this.getRowHeight()); TreePath path = BasicTreeUI.this.getClosestPathForLocation(tree, click.x, click.y);  if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = BasicTreeUI.this.getPathBounds( BasicTreeUI.this.tree, path);  bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4;  if (bounds.contains(click.x, click.y)) inBounds = true; else if (BasicTreeUI.this.hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true;  if ((inBounds || cntlClick) && BasicTreeUI.this.tree.isVisible(path)) { if (!cntlClick && !BasicTreeUI.this.isLeaf(row)) { Object cell = path.getLastPathComponent(); if (lastClicked != null && lastClicked.equals(cell)) clickCount = 2; else { lastClicked = cell; clickCount = 1; } }  if (clickCount == 2 || cntlClick == true) { clickCount = 0; lastClicked = null; BasicTreeUI.this.tree.getSelectionModel().clearSelection(); if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); try { BasicTreeUI.this.tree.fireTreeWillCollapse(path); } catch (ExpandVetoException ev) { } BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); try { BasicTreeUI.this.tree.fireTreeWillExpand(path); } catch (ExpandVetoException ev) { } BasicTreeUI.this.tree.fireTreeExpanded(path); } }  BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path); } } }
}
		public void mouseClicked(MouseEvent e)		{			Point click = e.getPoint();         int row = Math.round(click.y / BasicTreeUI.this.getRowHeight());      TreePath path = BasicTreeUI.this.getClosestPathForLocation(tree, click.x,                                                                 click.y);         if (path != null)         {            boolean inBounds = false;            boolean cntlClick = false;            Rectangle bounds = BasicTreeUI.this.getPathBounds(                                                            BasicTreeUI.this.tree,                                                            path);                      bounds.x -= rightChildIndent - 4;            bounds.width += rightChildIndent + 4;            if (bounds.contains(click.x, click.y))               inBounds = true;            else if (BasicTreeUI.this.hasControlIcons()                   && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x                                                                                 - rightChildIndent - 5)))               cntlClick = true;          if ((inBounds || cntlClick) && BasicTreeUI.this.tree.isVisible(path))            {               if (!cntlClick && !BasicTreeUI.this.isLeaf(row))               {                  Object cell = path.getLastPathComponent();                  if (lastClicked != null && lastClicked.equals(cell))                     clickCount = 2;                  else         {                                lastClicked = cell;                     clickCount = 1;                  }               }               if (clickCount == 2 || cntlClick == true)         {               clickCount = 0;                  lastClicked = null;                  BasicTreeUI.this.tree.getSelectionModel().clearSelection();            if (BasicTreeUI.this.tree.isExpanded(path))            {               BasicTreeUI.this.tree.collapsePath(path);                      try                        {                          BasicTreeUI.this.tree.fireTreeWillCollapse(path);                        }                      catch (ExpandVetoException ev)                        {                        }               BasicTreeUI.this.tree.fireTreeCollapsed(path);            }            else            {               BasicTreeUI.this.tree.expandPath(path);                      try                        {                          BasicTreeUI.this.tree.fireTreeWillExpand(path);                        }                      catch (ExpandVetoException ev)                        {                        }               BasicTreeUI.this.tree.fireTreeExpanded(path);            }			}                        BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path);		}      }      }