else if (!isAutoScrolling) startAutoScrolling(dir); } else if (e.getPoint().y < 0) { hasEntered = true; startAutoScrolling(SCROLL_UP);
    public void mouseDragged(MouseEvent e)    {      // convert point of the drag event relative to combo box list component      // figure out over which list cell the mouse is currently being dragged      // and highlight the cell. The list model is changed but the change has       // no effect on combo box's data model. The list model is changed so       // that the appropriate item would be highlighted in the combo box's       // list.      if (BasicComboPopup.this.isVisible())        {	  int cbHeight = (int) comboBox.getPreferredSize().getHeight();	  int popupHeight = BasicComboPopup.this.getSize().height;	  // if mouse is dragged inside the the combo box's items list.	  if (e.getY() > cbHeight && ! (e.getY() - cbHeight >= popupHeight))	    {	      int index = list.locationToIndex(new Point(e.getX(),	                                                 (int) (e.getY()	                                                 - cbHeight)));	      int firstVisibleIndex = list.getFirstVisibleIndex();	      // list.locationToIndex returns item's index that would	      // be located at the specified point if the first item that	      // is visible is item 0. However in the JComboBox it is not 	      // necessarily the case since list is contained in the 	      // JScrollPane so we need to adjust the index returned. 	      if (firstVisibleIndex != 0)		// FIXME: adjusted index here is off by one. I am adding one		// here to compensate for that. This should be		// index += firstVisibleIndex. Remove +1 once the bug is fixed.		index += firstVisibleIndex + 1;	      list.setSelectedIndex(index);	    }	  else	    {	      // if mouse is being dragged at the bottom of combo box's list 	      // of items or at the very top then scroll the list in the 	      // desired direction.	      boolean movingUP = e.getY() < cbHeight;	      boolean movingDown = e.getY() > cbHeight;	      if (movingUP)	        {		  scrollDirection = SCROLL_UP;		  startAutoScrolling(SCROLL_UP);	        }	      else if (movingDown)	        {		  scrollDirection = SCROLL_DOWN;		  startAutoScrolling(SCROLL_DOWN);	        }	    }        }    }