Start Search Contents Index Links About
BasicTest.java
/*
 * Author: Havard Rast Blok
 * E-mail: 
 * Web   : www.rememberjava.com
 */

import java.awt.*;
import javax.swing.*;

/*
 * Draws a point, polygon and rectangle
 */
public class BasicTest extends JFrame
{
  Point point;
  Polygon polygon;
  Rectangle rectangle;
  int xpoints[] {100150170160130};
  int ypoints[] {100,  80120150160};

  public BasicTest()
  {
    super("Geometry");
    setDefaultCloseOperationJFrame.EXIT_ON_CLOSE );
    setSize(300300);

    //init shapes
    point = new Point5050 );
    polygon = new Polygonxpoints, ypoints, xpoints.length );
    rectangle = new Rectangle2002005050 );

    show();
  }

  public void paintGraphics g )
  {
    //draw the objects based on the contained values
    g.drawLinepoint.x, point.y, point.x, point.y );
    g.fillPolygonpolygon );
    g.drawRectrectangle.x, rectangle.y, rectangle.width, rectangle.height );
  }

  public static void main(String args[])
  {
    new BasicTest();
  }
}


site: Håvard Rast Blok
mail:
updated: 27 July 2007