Java Reference
In-Depth Information
thisinterface.Thefollowingexampledemonstrateshowtocreateandinstalla
Poly-
gon
-based rectangular clip:
Polygon polygon = new Polygon();
polygon.addPoint(30, 30);
polygon.addPoint(60, 30);
polygon.addPoint(60, 60);
polygon.addPoint(30, 60);
g.clip(polygon);
Figure7-24
showstheresultoftryingtopainttheentiredrawingsurfacegreenafter
a clip has been installed.
Figure 7-24.
Select Clipping Shape from the Demo menu to view the clipping shape
demonstration.