This section illustrates you how to use Gradient Paint.
A gradient refers to a colored strip with two defined endpoints. Both the end points are defined with different color. 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, we have used the class Elipse2D which provides the shape oval. The class GradientPaint allows you to set up a gradient filled shape with a linear color gradient pattern.
Here is the code of SimpleGradientPaintExample.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