private void paintProgressIndicator ( SeaGlassContext context , Graphics2D g2d , int width , int height , int size , boolean isFinished ) { JProgressBar pBar = ( JProgressBar ) context . getComponent ( ) ; if ( tileWhenIndeterminate && pBar . isIndeterminate ( ) ) { double offsetFraction = ( double ) getAnimationIndex ( ) / ( double ) getFrameCount ( ) ; int offset = ( int ) ( offsetFraction * tileWidth ) ; if ( pBar . getOrientation ( ) == JProgressBar . HORIZONTAL ) { // If we're right-to-left, flip the direction of animation. if ( ! SeaGlassLookAndFeel . isLeftToRight ( pBar ) ) { offset = tileWidth - offset ; } // paint each tile horizontally for ( int i = - tileWidth + offset ; i <= width ; i += tileWidth ) { context . getPainter ( ) . paintProgressBarForeground ( context , g2d , i , 0 , tileWidth , height , pBar . getOrientation ( ) ) ; } } else { // paint each tile vertically for ( int i = - offset ; i < height + tileWidth ; i += tileWidth ) { context . getPainter ( ) . paintProgressBarForeground ( context , g2d , 0 , i , width , tileWidth , pBar . getOrientation ( ) ) ; } } } else { if ( pBar . getOrientation ( ) == JProgressBar . HORIZONTAL ) { int start = 0 ; if ( isFinished ) { size = width ; } else if ( ! SeaGlassLookAndFeel . isLeftToRight ( pBar ) ) { start = width - size ; } context . getPainter ( ) . paintProgressBarForeground ( context , g2d , start , 0 , size , height , pBar . getOrientation ( ) ) ; } else { // When the progress bar is vertical we always paint from bottom // to top, not matter what the component orientation is. int start = height ; if ( isFinished ) { size = height ; } context . getPainter ( ) . paintProgressBarForeground ( context , g2d , 0 , start , width , size , pBar . getOrientation ( ) ) ; } } }
Paint the actual internal progress bar .