public void positionAvoidAnimation ( Animation anim , Rectangle viewBounds ) { Rectangle abounds = new Rectangle ( anim . getBounds ( ) ) ; @ SuppressWarnings ( "unchecked" ) ArrayList < Animation > avoidables = ( ArrayList < Animation > ) _avoidAnims . clone ( ) ; // if we are able to place it somewhere, do so if ( SwingUtil . positionRect ( abounds , viewBounds , avoidables ) ) { anim . setLocation ( abounds . x , abounds . y ) ; } // add the animation to the list of avoidables _avoidAnims . add ( anim ) ; // keep an eye on it so that we can remove it when it's finished anim . addAnimationObserver ( _avoidAnimObs ) ; }
Position the specified animation so that it is not overlapping any still - running animations previously passed to this method .