|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTurtleGraphics.AbstractPen
public abstract class AbstractPen
Copyright 2006 by Ken Lambert and Martin Osborne.
Provides behavior and data common to all pens.
Field Summary | |
---|---|
protected java.awt.Color |
color
|
protected double |
direction
|
protected boolean |
isDown
|
protected SketchPad |
pad
|
protected int |
width
|
protected double |
xPos
|
protected double |
yPos
|
Constructor Summary | |
---|---|
AbstractPen(SketchPad p)
|
Method Summary | |
---|---|
void |
down()
Action: The pen lowers itself to the drawing surface. |
protected abstract void |
drawLine(double x,
double y)
|
abstract void |
drawString(java.lang.String text)
Action: Draws the string at the pen's position. |
void |
home()
The pen jumps to the center of the graphics window without drawing and points north. |
boolean |
isDown()
|
void |
move(double distance)
Action: The pen moves the specified distance in the current direction. |
void |
move(double x,
double y)
Action: Moves the pen to the position (x, y). |
void |
setColor(java.awt.Color c)
Action: Sets the pen's color to the specified color. |
void |
setDirection(double d)
Action: The pen points in the indicated direction. |
void |
setWidth(int w)
Action: Sets the pen's width to the specified width (the default width is 2 pixels). |
java.lang.String |
toString()
Action: Returns information about the pen's state. |
void |
turn(double degrees)
Action: The pen adds the indicated degrees to its current direction. |
protected void |
turn(double x,
double y)
|
void |
up()
Action: The pen raises itself from the drawing surface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double xPos
protected double yPos
protected double direction
protected int width
protected boolean isDown
protected java.awt.Color color
protected SketchPad pad
Constructor Detail |
---|
public AbstractPen(SketchPad p)
Method Detail |
---|
public void down()
Pen
down
in interface Pen
public abstract void drawString(java.lang.String text)
Pen
drawString
in interface Pen
public void home()
Pen
home
in interface Pen
public void move(double distance)
Pen
move
in interface Pen
public void move(double x, double y)
Pen
move
in interface Pen
public boolean isDown()
public void setColor(java.awt.Color c)
Pen
setColor
in interface Pen
public void setDirection(double d)
Pen
setDirection
in interface Pen
public void setWidth(int w)
Pen
setWidth
in interface Pen
public java.lang.String toString()
Pen
toString
in interface Pen
toString
in class java.lang.Object
public void turn(double degrees)
Pen
turn
in interface Pen
public void up()
Pen
up
in interface Pen
protected abstract void drawLine(double x, double y)
protected void turn(double x, double y)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |