Flags with Polygons Tutorial
A polygon is a closed shape made up of straight lines (like a triangle or a square). See Polygons for details of how to do this.
The Napier flag is a red triangle on a white square. It suggests the
We create a polygon in order to fill it. The http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Polygon.html Polygon class is part of the standard awt package. We create a polygon then add points to it as required.
We need four triangles to draw the flag of Jamaica. If we get it right we will leave a yellow cross.
The Seychelles has a cheerful flag; four triangles and a quadrilateral.
We tire of coming up with names for our polygons. In this example we reuse the same old polygon - we reset it after it has done its job.
- the green is