protected void checkAutoscroll ( MouseEvent exitEvent ) { Component comp = exitEvent . getComponent ( ) ; Point p = exitEvent . getPoint ( ) ; try { Point scr = comp . getLocationOnScreen ( ) ; p . translate ( scr . x , scr . y ) ; } catch ( IllegalComponentStateException icse ) { // the component is no longer on screen. Deal. return ; } Component parent ; DropTarget target ; while ( true ) { target = _droppers . get ( comp ) ; if ( target instanceof AutoscrollingDropTarget ) { AutoscrollingDropTarget adt = ( AutoscrollingDropTarget ) target ; JComponent jc = ( JComponent ) comp ; Rectangle r = getRectOnScreen ( jc ) ; // make sure we're actually out of the autoscrolling component if ( ! r . contains ( p ) ) { // start autoscrolling. _scrollComp = jc ; _scrollDim = adt . getAutoscrollBorders ( ) ; _scrollPoint = p ; _scrollTimer . start ( ) ; return ; } } parent = comp . getParent ( ) ; if ( parent == null ) { return ; } comp = parent ; } }
Check to see if we want to enter autoscrolling mode .