private void redrawLater ( int delay ) { boolean already = ( redrawTimer != null ) && ( redrawTimer . isRunning ( ) ) ; if ( debugThread ) System . out . println ( "redrawLater isRunning= " + already ) ; if ( already ) return ; // initialize Timer the first time if ( redrawTimer == null ) { redrawTimer = new javax . swing . Timer ( 0 , new ActionListener ( ) { public void actionPerformed ( ActionEvent e ) { drawG ( ) ; redrawTimer . stop ( ) ; // one-shot timer } } ) ; } // start the timer running redrawTimer . setDelay ( delay ) ; redrawTimer . start ( ) ; }
from panning so wait delay msecs before doing the redraw .