A gradient is like a colored strip. It is created by specifying a color at one point and another color at another point.
Another Example of Gradient Paint
This section shows you the gradient Paint on rounded corner rectangle.
A gradient is like a colored strip. It is created by specifying a
color at one point and another color at another point. Then the colors will
gradually from one to the other along a straight line between the two
To use a Gradient paint, you must have a shape object and two end points. The
class RoundRectangle2D defines a rectangle with rounded corners defined
by a location (x, y), a dimension (w x h), and the width and
height of an arc with which to round the corners. The
class GradientPaint allows you to set up a gradient filled shape with a
linear color gradient pattern.