The Paint interface for filling objects
With Graphics2D, the current graphics context includes the current “paint”: g2d.setPaint ( p );where p is anything that implements the interface Paint.
The Color class implements Paint.
New classes include GradientPaint, SystemColor, and TexturePaint.
- new GradientPaint ( x1, y1, color1, x2, y2, color2, boolval )colors a gradient which starts at the first coordinate and shades in the direction of the section coordinate, shading from the first color to the second color. The boolean value determines whether the shading is cyclic (true) or acyclic (false).
- new TexturePaint ( image, rectangle )where the image is cropped to the size of the rectangle arg and used to tile the space.