Java Code

/* Purpose: Demonstrate Polygons
 * @Author : ESBoese
 * @Version : Spring 2007
 */
import javax.swing.*;
import java.awt.*;
public class PolyEx1 extends JApplet
{
  public void paint( Graphics g )
  {
		Polygon pg = new Polygon( );
		pg.addPoint( 10, 10 );
		pg.addPoint( 50, 10 );
		pg.addPoint( 70, 80 );
		pg.addPoint( 50, 100 );
		pg.addPoint( 10, 30 );
		g.drawPolygon( pg );
  }
}

Back to Code Examples
©2006- by E.S.Boese. All Rights Reserved