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 starts changes gradually from one to the other along a straight line between the two points.
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.
Here is the code of GradientPaintRectangle.java
Output will be displayed as:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial