Java Reference
In-Depth Information
created a Swing-based Graphics2DAttribDemo application. Figure 7-17 shows
you this menu-driven application's initial screen.
Figure 7-17. Select a menuitem from the Demo menu to view a demonstration of the as-
sociated attribute.
Graphics2D declares void setPaint(Paint paint) forsettingthepaintat-
tribute. Pass any object whose class implements the java.awt.Paint interface to
paint . Call Paint getPaint() to return the current paint.
Several classes implement Paint , including the java.awt package's Color ,
GradientPaint , and TexturePaint classes. Instances of these classes can be
passed to setPaint() or returned from getPaint() .
Note The Graphics class's setColor() method is equivalent to calling
setPaint() .
Search WWH ::

Custom Search