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
-
DEFAULT_COLOR
- This specifies the default color for a line.
-
Line(int, int, int, int)
- Construct a line, specifying all 4 coordinates and using
the default color.
-
Line(int, int, int, int, Color)
- Construct a line, specifying all 4 coordinates and a specific
color.
-
drawOn(Graphics)
-
-
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.
-
packLine(Line)
- This method converts a Line into a String.
DEFAULT_COLOR
public static final Color DEFAULT_COLOR
- This specifies the default color for a line.
It may not be changed.
Line
public Line(int startX,
int startY,
int endX,
int endY)
- Construct a line, specifying all 4 coordinates and using
the default color.
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
drawOn
public void drawOn(Graphics g)
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
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