edu.byu.phun2d
Class Line

java.lang.Object
  extended by edu.byu.phun2d.DrawObj
      extended by edu.byu.phun2d.Line

public class Line
extends DrawObj

A Line draws a straight line between points (x1,y1) and (x2,y2). The color of the line is determined by setLineColor() and the width of the line is determined by setLineWidth().


Constructor Summary
Line(double x1, double y1, double x2, double y2)
          This will create a new line object that will draw a line between (x1,y1) and (x2,y2).
 
Method Summary
 void setP1(double x1, double y1)
          This will change the coordinates of the first end point of this line.
 void setP2(double x2, double y2)
          This will change the coordinates of the second end point of this line.
 double x1()
          The X coordinate of the first end point.
 double x2()
          the X coordinate of the second end point.
 double y1()
          The Y coordinate of the first end point.
 double y2()
          The Y coordinate of the second end point.
 
Methods inherited from class edu.byu.phun2d.DrawObj
getFillColor, getLineColor, getLineWidth, getRotate, getScaleX, getScaleY, getTranslate, insideToOutside, outsideToInside, setFillColor, setLineColor, setLineWidth, setRotate, setScale, setTranslate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Line

public Line(double x1,
            double y1,
            double x2,
            double y2)
This will create a new line object that will draw a line between (x1,y1) and (x2,y2). The color and thickness of the line will be controlled by setLineColor() and setLineWidth().

Parameters:
x1 - the X coordinate of the first end point.
y1 - the Y coordinate of the first end point.
x2 - the X coordinate of the second end point.
y2 - the Y coordinate of the second end point.
Method Detail

setP1

public void setP1(double x1,
                  double y1)
This will change the coordinates of the first end point of this line.

Parameters:
x1 - the X coordinate of the new first end point.
y1 - the Y coordinate of the new first end point.

setP2

public void setP2(double x2,
                  double y2)
This will change the coordinates of the second end point of this line.

Parameters:
x2 - the X coordinate of the new second end point.
y2 - the Y coordinate of the new second end point.

x1

public double x1()
The X coordinate of the first end point.

Returns:

y1

public double y1()
The Y coordinate of the first end point.

Returns:

x2

public double x2()
the X coordinate of the second end point.

Returns:

y2

public double y2()
The Y coordinate of the second end point.

Returns: