public class TurtlePen
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
color |
private java.util.List<LineSegment> |
lineSegments |
private boolean |
penStateDown |
private int |
width |
Constructor and Description |
---|
TurtlePen()
TurtlePen Default Constructor
|
TurtlePen(int width,
java.awt.Color color)
TurtlePen non-default Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLineSegment(LineSegment lineSegment)
Adds a lineSegment
|
java.awt.Color |
getColor() |
java.util.List<LineSegment> |
getLineSegments() |
int |
getWidth() |
boolean |
isPenDown() |
void |
paint(java.awt.Graphics g)
paints the line if the pen is down
|
void |
setColor(java.awt.Color newColor)
Sets the color of the pen
|
void |
setPenDown()
sets the pen state down
|
void |
setPenUp()
sets the pen state up
|
void |
setWidth(int newWidth)
Sets the width of the pen
|
private java.util.List<LineSegment> lineSegments
private boolean penStateDown
private java.awt.Color color
private int width
public TurtlePen(int width, java.awt.Color color)
width
- width of the pencolor
- color of the penpublic TurtlePen()
public void paint(java.awt.Graphics g)
g
- is the Graphics module that knows how to do graphics stuff herepublic void addLineSegment(LineSegment lineSegment)
lineSegment
- is the lineSegment addedpublic void setColor(java.awt.Color newColor)
newColor
- is the new color of the penpublic void setWidth(int newWidth)
newWidth
- is the new width of the penpublic java.awt.Color getColor()
public int getWidth()
public java.util.List<LineSegment> getLineSegments()
public boolean isPenDown()
public void setPenUp()
public void setPenDown()