BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(next.getPath()));
{ TreePath newPath = new TreePath(next.getPath()); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } }
		public void keyPressed(KeyEvent e)		{         TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath();         DefaultMutableTreeNode last = null;                  if (start != null)            last = (DefaultMutableTreeNode) start.getLastPathComponent();         if (last != null)         {            if (e.getKeyCode() == KeyEvent.VK_DOWN)            {               DefaultMutableTreeNode next = (DefaultMutableTreeNode)                   BasicTreeUI.this.getNextVisibleNode(last);                              if (next != null)                  BasicTreeUI.this.selectPath(BasicTreeUI.this.tree,                        new TreePath(next.getPath()));            }            else if (e.getKeyCode() == KeyEvent.VK_UP)            {               DefaultMutableTreeNode prev = (DefaultMutableTreeNode)                BasicTreeUI.this.getPreviousVisibleNode(last);                        if (prev != null)               BasicTreeUI.this.selectPath(BasicTreeUI.this.tree,                     new TreePath(prev.getPath()));            }            else if (e.getKeyCode() == KeyEvent.VK_LEFT)            {               TreePath path = new TreePath(last.getPath());                              if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path))               {                  BasicTreeUI.this.tree.collapsePath(path);                  BasicTreeUI.this.tree.fireTreeCollapsed(path);               }            }            else if (e.getKeyCode() == KeyEvent.VK_RIGHT)            {               TreePath path = new TreePath(last.getPath());                  if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path))               {                  BasicTreeUI.this.tree.expandPath(path);                  BasicTreeUI.this.tree.fireTreeExpanded(path);               }            }         }		}