Difference between revisions of "Flags with Polygons Tutorial"

From Progzoo
Jump to: navigation, search
Line 5: Line 5:
 
<question height="150" width="150" imgOut="flag.png" className="Raster" title="Napier">
 
<question height="150" width="150" imgOut="flag.png" className="Raster" title="Napier">
 
The Napier flag is a red triangle on a white square. It suggests the
 
The Napier flag is a red triangle on a white square. It suggests the
letter N.<br/>
+
letter N.<br/>  
 
[[Image:flagnapier.png]]<br/>
 
[[Image:flagnapier.png]]<br/>
 
We create a polygon in order to fill it. The
 
We create a polygon in order to fill it. The

Revision as of 16:25, 7 October 2008

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.

Napier

The Napier flag is a red triangle on a white square. It suggests the letter N.
Flagnapier.png
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.



[Font] [Default] [Show] [Resize] [History] [Profile]

Bahamas

To complete the flag of the Bahamas you must add the black triangle which represents the unity and vigour of the people.

Flagbahamas.png


[Font] [Default] [Show] [Resize] [History] [Profile]

Jamaica

We need to four triangle to draw the flag of Jamaica. If we get it right we will leave a yellow cross.

Flagjamaica.png


[Font] [Default] [Show] [Resize] [History] [Profile]

Seychelles

The Seychelles has a cheerful flag; four triangles and a quadrilateral.

Flagseychelles.png


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.



[Font] [Default] [Show] [Resize] [History] [Profile]