protected Paint createHorizontalGradient(Shape s,FourColors colors){
  Rectangle2D bounds=s.getBounds2D();
  float x=(float)bounds.getX();
  float y=(float)bounds.getY();
  float w=(float)bounds.getWidth();
  float h=(float)bounds.getHeight();
  return createGradient(x,(0.5f * h) + y,x + w,(0.5f * h) + y,new float[]{0f,0.45f,0.62f,1f},new Color[]{colors.top,colors.upperMid,colors.lowerMid,colors.bottom});
}

protected Paint createHorizontalGradient ( Shape s , FourColors colors ) { Rectangle2D bounds = s . getBounds2D ( ) ; float x = ( float ) bounds . getX ( ) ; float y = ( float ) bounds . getY ( ) ; float w = ( float ) bounds . getWidth ( ) ; float h = ( float ) bounds . getHeight ( ) ; return createGradient ( x , ( 0.5f * h ) + y , x + w , ( 0.5f * h ) + y , new float [ ] { 0f , 0.45f , 0.62f , 1f } , new Color [ ] { colors . top , colors . upperMid , colors . lowerMid , colors . bottom } ) ; }
creates a simple horizontal gradient using the shape for bounds and the colors for top , two middle , and bottom colors .
