CS101 Package Problem Set Javadocs

cs101.awt
Class Line

java.lang.Object
  extended bycs101.awt.Line

public class Line
extends java.lang.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.

Copyright 1996 Massachusetts Institute of Technology

Version:
$Id: Line.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $
Author:
Maciej Stachowiak, maciej@ai.mit.edu, Lynn Andrea Stein, las@ai.mit.edu
See Also:
Graphics

Field Summary
static java.awt.Color DEFAULT_COLOR
          This specifies the default color for a line.
 
Constructor Summary
Line(int startX, int startY, int endX, int endY)
          Construct a line, specifying all 4 coordinates and using the default color.
Line(int startX, int startY, int endX, int endY, java.awt.Color c)
          Construct a line, specifying all 4 coordinates and a specific color.
 
Method Summary
 void drawOn(java.awt.Graphics g)
           
static Line extractLine(java.lang.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.
static java.lang.String packLine(Line l)
          This method converts a Line into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COLOR

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

Constructor Detail

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,
            java.awt.Color c)
Construct a line, specifying all 4 coordinates and a specific color.

See Also:
Color
Method Detail

drawOn

public void drawOn(java.awt.Graphics g)

extractLine

public static Line extractLine(java.lang.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(cs101.awt.Line)

packLine

public static java.lang.String packLine(Line l)
This method converts a Line into a String.

See Also:
extractLine(java.lang.String)

CS101 Package Problem Set Javadocs