public void dragOver(DropTargetDragEvent e){
  Point pt=e.getLocation();
  if (pt.equals(_ptLast)) {
    return;
  }
  int nDeltaLeftRight=pt.x - _ptLast.x;
  if (((_nLeftRight > 0) && (nDeltaLeftRight < 0)) || ((_nLeftRight < 0) && (nDeltaLeftRight > 0))) {
    _nLeftRight=0;
  }
  _nLeftRight+=nDeltaLeftRight;
  _ptLast=pt;
  Graphics2D g2=(Graphics2D)getGraphics();
  if (!DragSource.isDragImageSupported()) {
    paintImmediately(_raGhost.getBounds());
    _raGhost.setRect(pt.x - m_ptOffset.x,pt.y - m_ptOffset.y,m_imgGhost.getWidth(),m_imgGhost.getHeight());
    g2.drawImage(m_imgGhost,AffineTransform.getTranslateInstance(_raGhost.getX(),_raGhost.getY()),null);
  }
 else {
    paintImmediately(_raCueLine.getBounds());
  }
  TreePath path=getClosestPathForLocation(pt.x,pt.y);
  if (!(path == _pathLast)) {
    _nLeftRight=0;
    _pathLast=path;
    _timerHover.restart();
  }
  Rectangle raPath=getPathBounds(path);
  _raCueLine.setRect(0,raPath.y + (int)raPath.getHeight(),getWidth(),2);
  g2.setColor(_colorCueLine);
  g2.fill(_raCueLine);
  if (_nLeftRight > 20) {
    g2.drawImage(_imgRight,AffineTransform.getTranslateInstance(pt.x - m_ptOffset.x,pt.y - m_ptOffset.y),null);
    _nShift=+1;
  }
 else   if (_nLeftRight < -20) {
    g2.drawImage(_imgLeft,AffineTransform.getTranslateInstance(pt.x - m_ptOffset.x,pt.y - m_ptOffset.y),null);
    _nShift=-1;
  }
 else {
    _nShift=0;
  }
  _raGhost=_raGhost.createUnion(_raCueLine);
  if (path.equals(m_selectedTreePath)) {
    e.rejectDrag();
  }
 else {
    e.acceptDrag(e.getDropAction());
  }
}

public void dragOver ( DropTargetDragEvent e ) { Point pt = e . getLocation ( ) ; if ( pt . equals ( _ptLast ) ) { return ; } int nDeltaLeftRight = pt . x - _ptLast . x ; if ( ( ( _nLeftRight > 0 ) && ( nDeltaLeftRight < 0 ) ) || ( ( _nLeftRight < 0 ) && ( nDeltaLeftRight > 0 ) ) ) { _nLeftRight = 0 ; } _nLeftRight += nDeltaLeftRight ; _ptLast = pt ; Graphics2D g2 = ( Graphics2D ) getGraphics ( ) ; if ( ! DragSource . isDragImageSupported ( ) ) { paintImmediately ( _raGhost . getBounds ( ) ) ; _raGhost . setRect ( pt . x - m_ptOffset . x , pt . y - m_ptOffset . y , m_imgGhost . getWidth ( ) , m_imgGhost . getHeight ( ) ) ; g2 . drawImage ( m_imgGhost , AffineTransform . getTranslateInstance ( _raGhost . getX ( ) , _raGhost . getY ( ) ) , null ) ; } else { paintImmediately ( _raCueLine . getBounds ( ) ) ; } TreePath path = getClosestPathForLocation ( pt . x , pt . y ) ; if ( ! ( path == _pathLast ) ) { _nLeftRight = 0 ; _pathLast = path ; _timerHover . restart ( ) ; } Rectangle raPath = getPathBounds ( path ) ; _raCueLine . setRect ( 0 , raPath . y + ( int ) raPath . getHeight ( ) , getWidth ( ) , 2 ) ; g2 . setColor ( _colorCueLine ) ; g2 . fill ( _raCueLine ) ; if ( _nLeftRight > 20 ) { g2 . drawImage ( _imgRight , AffineTransform . getTranslateInstance ( pt . x - m_ptOffset . x , pt . y - m_ptOffset . y ) , null ) ; _nShift = + 1 ; } else if ( _nLeftRight < - 20 ) { g2 . drawImage ( _imgLeft , AffineTransform . getTranslateInstance ( pt . x - m_ptOffset . x , pt . y - m_ptOffset . y ) , null ) ; _nShift = - 1 ; } else { _nShift = 0 ; } _raGhost = _raGhost . createUnion ( _raCueLine ) ; if ( path . equals ( m_selectedTreePath ) ) { e . rejectDrag ( ) ; } else { e . acceptDrag ( e . getDropAction ( ) ) ; } }
this is where the ghost image is drawn
