All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cs101.util.Line

java.lang.Object
   |
   +----cs101.util.Line

public class Line
extends Object
Implements a 4-coordinate (+ optional Color) line abstraction with its own drawing method. Also, implements a translation between Line objects and String objects for handling by less intelligent protocols.

See Also:
Graphics

Variable Index

 o DEFAULT_COLOR
This specifies the default color for a line.

Constructor Index

 o Line(int, int, int, int)
Construct a line, specifying all 4 coordinates and using the default color.
 o Line(int, int, int, int, Color)
Construct a line, specifying all 4 coordinates and a specific color.

Method Index

 o drawOn(Graphics)
 o extractLine(String)
Given a String that was originally created by packLine, this function will return a reference to a new Line object that represents the original Line.
 o packLine(Line)
This method converts a Line into a String.

Variables

 o DEFAULT_COLOR
 public static final Color DEFAULT_COLOR
This specifies the default color for a line. It may not be changed.

Constructors

 o Line
 public Line(int startX,
             int startY,
             int endX,
             int endY)
Construct a line, specifying all 4 coordinates and using the default color.

 o Line
 public Line(int startX,
             int startY,
             int endX,
             int endY,
             Color c)
Construct a line, specifying all 4 coordinates and a specific color.

See Also:
Color

Methods

 o drawOn
 public void drawOn(Graphics g)
 o extractLine
 public static Line extractLine(String s)
Given a String that was originally created by packLine, this function will return a reference to a new Line object that represents the original Line.

See Also:
packLine
 o packLine
 public static String packLine(Line l)
This method converts a Line into a String.

See Also:
extractLine

All Packages  Class Hierarchy  This Package  Previous  Next  Index