question: protected Paint createVerticalGradient ( Shape s , TwoColors colors ) { Rectangle2D bounds = s . getBounds2D ( ) ; float xCenter = ( float ) bounds . getCenterX ( ) ; float yMin = ( float ) bounds . getMinY ( ) ; float yMax = ( float ) bounds . getMaxY ( ) ; return createGradient ( xCenter , yMin , xCenter , yMax , new float [ ] { 0f , 1f } , new Color [ ] { colors . top , colors . bottom } ) ; }
target:  Creates a simple vertical gradient using the shape for bounds and the colors for top and bottom colors.