protected void renderLayer ( Graphics2D g , Rectangle bounds , JLayeredPane pane , boolean [ ] clipped , Integer layer ) { // stop now if there are no components in that layer int ccount = pane . getComponentCountInLayer ( layer . intValue ( ) ) ; if ( ccount == 0 ) { return ; } // render them up Component [ ] comps = pane . getComponentsInLayer ( layer . intValue ( ) ) ; for ( int ii = 0 ; ii < ccount ; ii ++ ) { Component comp = comps [ ii ] ; if ( ! comp . isVisible ( ) || comp instanceof SafeLayerComponent ) { continue ; } // if this overlay does not intersect the component we just rendered, we don't need to // repaint it Rectangle compBounds = new Rectangle ( 0 , 0 , comp . getWidth ( ) , comp . getHeight ( ) ) ; getRoot ( comp , compBounds ) ; if ( ! compBounds . intersects ( bounds ) ) { continue ; } // if the clipping region has not yet been set during this render pass, the time has // come to do so if ( ! clipped [ 0 ] ) { g . setClip ( bounds ) ; clipped [ 0 ] = true ; } // translate into the components coordinate system and render g . translate ( compBounds . x , compBounds . y ) ; try { comp . paint ( g ) ; } catch ( Exception e ) { log . warning ( "Component choked while rendering." , e ) ; } g . translate ( - compBounds . x , - compBounds . y ) ; } }
Renders all components in the specified layer of the supplied layered pane that intersect the supplied bounds .