slogo.gui
Class PenLine

java.lang.Object
  extended by slogo.gui.PenLine

public class PenLine
extends java.lang.Object

A class representation of the line being drawn by the turtle, allows us to store some extra info, e.g. Color

Author:
gehmane

Field Summary
private  java.awt.geom.Point2D endP
           
private  java.awt.Color myColor
           
private  java.awt.geom.Line2D myLine
           
private  java.awt.geom.Point2D startP
           
 
Constructor Summary
PenLine(java.awt.geom.Point2D start, java.awt.geom.Point2D end, java.awt.Color c)
           
 
Method Summary
 void draw(java.awt.Graphics g)
          Draws the line from start point to end point in the line's color
 java.awt.Color getColor()
          Gets the line's color
 java.awt.geom.Point2D getEndPoint()
          Gets the end point of the line
 java.awt.geom.Point2D getStartPoint()
          Gets the start point for the line
 void setColor(java.awt.Color c)
          Set the color for the line
 void setEndPoint(java.awt.geom.Point2D p)
          Set end point for the line
 void setStartPoint(java.awt.geom.Point2D p)
          Set start point for the line
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myLine

private java.awt.geom.Line2D myLine

startP

private java.awt.geom.Point2D startP

endP

private java.awt.geom.Point2D endP

myColor

private java.awt.Color myColor
Constructor Detail

PenLine

public PenLine(java.awt.geom.Point2D start,
               java.awt.geom.Point2D end,
               java.awt.Color c)
Method Detail

draw

public void draw(java.awt.Graphics g)
Draws the line from start point to end point in the line's color

Parameters:
g - graphics that draw the point

getStartPoint

public java.awt.geom.Point2D getStartPoint()
Gets the start point for the line

Returns:
the start point

getEndPoint

public java.awt.geom.Point2D getEndPoint()
Gets the end point of the line

Returns:
the end point

getColor

public java.awt.Color getColor()
Gets the line's color

Returns:
the color of the line

setColor

public void setColor(java.awt.Color c)
Set the color for the line

Parameters:
c - is the color the line will be drawn as

setStartPoint

public void setStartPoint(java.awt.geom.Point2D p)
Set start point for the line

Parameters:
p - is the coordinate point for the line's start point

setEndPoint

public void setEndPoint(java.awt.geom.Point2D p)
Set end point for the line

Parameters:
p - is the coordinate point for the line's end point