February 2014
Beginner
1248 pages
62h 25m
English
The first shape we draw is an oval filled with gradually changing colors. Lines 28–29 invoke Graphics2D method setPaint to set the Paint object that determines the color for the shape to display. A Paint object implements interface java.awt.Paint. It can be something as simple as one of the predeclared Color objects introduced in Section 13.3 (class Color implements Paint), or it can be an instance of the Java 2D API’s GradientPaint, SystemColor, TexturePaint, LinearGradientPaint or RadialGradientPaint classes. In this case, we use a GradientPaint object.
Class GradientPaint helps draw a shape in gradually changing colors—called a gradient. The GradientPaint constructor used here requires seven arguments. ...
Read now
Unlock full access