All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cs101.canvas.Line

java.lang.Object
   |
   +----cs101.canvas.GraphicsObject
           |
           +----cs101.canvas.Line

public class Line
extends GraphicsObject
A GraphicsObject that represents a geometric line


Constructor Index

 o Line(int, int, int, int)
Constructs a new Line from two points with
black as the default color
 o Line(int, int, int, int, Color)
Construct a new Line from two points with
the passed color

Method Index

 o draw(Graphics)
 o getX1()
 o getX2()
 o getY1()
 o getY2()
 o movePoint1(int, int)
 o movePoint2(int, int)
 o toString()

Constructors

 o Line
 public Line(int x1,
             int y1,
             int x2,
             int y2)
Constructs a new Line from two points with
black as the default color

Parameters:
x1 - x coordinate of first point
y1 - y coordinate of first point
x2 - x coordinate of second point
y2 - y coordinate of second point
Returns:
none
 o Line
 public Line(int x1,
             int y1,
             int x2,
             int y2,
             Color graphicsColor)
Construct a new Line from two points with
the passed color

Parameters:
x1 - x coordinate of first point
y1 - y coordinate of first point
x2 - x coordinate of second point
y2 - y coordinate of second point
graphicsColor - color of Line
Returns:
none

Methods

 o movePoint1
 public void movePoint1(int x,
                        int y)
 o movePoint2
 public void movePoint2(int x,
                        int y)
 o getX1
 public int getX1()
 o getY1
 public int getY1()
 o getX2
 public int getX2()
 o getY2
 public int getY2()
 o draw
 public void draw(Graphics g)
Overrides:
draw in class GraphicsObject
 o toString
 public String toString()
Overrides:
toString in class GraphicsObject

All Packages  Class Hierarchy  This Package  Previous  Next  Index