TurtleGraphics
Class Shapes

java.lang.Object
  extended by TurtleGraphics.Shapes

public class Shapes
extends java.lang.Object

Copyright 2006 by Ken Lambert and Martin Osborne.

Provides an application window with a pen for drawing lines, circles, and rectangles.


Constructor Summary
Shapes()
           
Shapes(int width, int height)
           
 
Method Summary
 void drawCircle(double x, double y, double r)
          Action: Draws a circle.
 void drawLine(double x1, double y1, double x2, double y2)
          Action: Draws a line segment.
 void drawRectangle(double x, double y, double w, double h)
          Action: Draws a rectangle.
 void setColor(java.awt.Color color)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shapes

public Shapes()

Shapes

public Shapes(int width,
              int height)
Method Detail

setColor

public void setColor(java.awt.Color color)

drawLine

public void drawLine(double x1,
                     double y1,
                     double x2,
                     double y2)
Action: Draws a line segment.

Parameters:
x1 - The line segment's initial x coordinate
y1 - The line segment's initial y coordinate
x2 - The line segment's ending x coordinate
y2 - The line segment's ending y coordinate

drawCircle

public void drawCircle(double x,
                       double y,
                       double r)
Action: Draws a circle.

Parameters:
x - The x coordinate of the circle's center point
y - The y coordinate of the circle's center point
r - The circle's radius

drawRectangle

public void drawRectangle(double x,
                          double y,
                          double w,
                          double h)
Action: Draws a rectangle.

Parameters:
x - The x coordinate of the rectangle's upper left corner point
y - The y coordinate of the rectangle's upper left corner point
w - The rectangle's width
h - The rectangle's height