code: protected Paint createHorizontalGradient(Shape s, TwoColors colors) {
          Rectangle2D bounds  = s.getBounds2D();
          float       xMin    = (float) bounds.getMinX();
          float       xMax    = (float) bounds.getMaxX();
          float       yCenter = (float) bounds.getCenterY();
  
          return createGradient(xMin, yCenter, xMax, yCenter, new float[] { 0f, 1f }, new Color[] { colors.top, colors.bottom });
      }
docs: Creates a simple horizontal gradient using the shape for bounds and the
  colors for top and bottom colors.
  
  @param  s      the shape to use for bounds.
  @param  colors the colors to use for the gradient.
  
  @return the gradient.