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 and two end points. The class RoundRectangle2D defines a rectangle with rounded 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