Class DrawingTool

java.lang.Object
  |
  +--AView
        |
        +--DrawingTool

public class DrawingTool
extends AView

DrawingTool is like a drawing pen that can be moved around a drawing canvas This is similar to a turtle from the LOGO programming language. Class Invariant parentContainer == window AND up <= direction <= left

See Also:
Serialized Form

Constructor Summary
DrawingTool()
          postcondition old window != null IMPLIES window == old window AND window.getWidth()==400 AND window.getHeight()==300 AND getX()==195 AND getY()==141 AND getWidth()==getHeight()==9 AND isDrawing AND direction == up AND getColor() == Color.green
 
Method Summary
 void dontDraw()
          postconditon NOT isDrawing AND getColor == Color.red
 void draw()
          postconditon isDrawing AND getColor == Color.green
 void fill(java.awt.Graphics g)
          postconditon this AView is drawn as an arrow using the given getColor()
 void finalize()
          postconditon window == null
 void moveForward()
          postconditon (locX, locY) is a point that is 20 units from (old locX, old locY) moving according to direction AND isDrawing IMPLIES a line segment is drawn connecting (locX, locY) with (old locX, old locY)
 void moveForwardBy(int d)
          postconditon (locX, locY) is a point that is d units from (old locX, old locY) moving according to direction AND isDrawing IMPLIES a line segment is drawn connecting (locX, locY) with (old locX, old locY)
 void stroke(java.awt.Graphics g)
          postconditon this AView is drawn as an arrow using the given getColor()
 void turnClockwise()
          postconditon direction == a 90 clockwise rotation from old direction
 void turnCounterclockwise()
          postconditon direction == a 90 counterclockwise rotation from old direction
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawingTool

public DrawingTool()
postcondition old window != null IMPLIES window == old window AND window.getWidth()==400 AND window.getHeight()==300 AND getX()==195 AND getY()==141 AND getWidth()==getHeight()==9 AND isDrawing AND direction == up AND getColor() == Color.green

Method Detail

dontDraw

public void dontDraw()
postconditon NOT isDrawing AND getColor == Color.red


draw

public void draw()
postconditon isDrawing AND getColor == Color.green


fill

public void fill(java.awt.Graphics g)
postconditon this AView is drawn as an arrow using the given getColor()


finalize

public void finalize()
postconditon window == null


moveForward

public void moveForward()
postconditon (locX, locY) is a point that is 20 units from (old locX, old locY) moving according to direction AND isDrawing IMPLIES a line segment is drawn connecting (locX, locY) with (old locX, old locY)


moveForwardBy

public void moveForwardBy(int d)
postconditon (locX, locY) is a point that is d units from (old locX, old locY) moving according to direction AND isDrawing IMPLIES a line segment is drawn connecting (locX, locY) with (old locX, old locY)


stroke

public void stroke(java.awt.Graphics g)
postconditon this AView is drawn as an arrow using the given getColor()


turnClockwise

public void turnClockwise()
postconditon direction == a 90 clockwise rotation from old direction


turnCounterclockwise

public void turnCounterclockwise()
postconditon direction == a 90 counterclockwise rotation from old direction



Generated by BlueJ