public void update ( final Graphics g ) { final Dimension d = getSize ( ) ; if ( ( this . offScreenImage == null ) ) { this . offScreenImage = createImage ( d . width , d . height ) ; } paint ( this . offScreenImage . getGraphics ( ) ) ; g . drawImage ( this . offScreenImage , 0 , 0 , null ) ; }
Use double buffering .