Class Line

java.lang.Object
  extended byLine
Direct Known Subclasses:
HLine, VLine

public abstract class Line
extends Object

A Line has a length and a paintChar used to paint itself on a Screen. Subclasses of this abstract class specify the direction of the Line.

Version:
5

Field Summary
protected  int length
           
protected  char paintChar
           
 
Constructor Summary
protected Line(int length, char paintChar)
          Construct a Line.
 
Method Summary
 int getLength()
          Get the length of this line.
 char getPaintChar()
          Get the paintChar of this Line.
 void paintOn(Screen s)
          Paint this Line on Screen s at position (0,0).
abstract  void paintOn(Screen s, int x, int y)
          Paint this Line on Screen s at position (x,y).
 void setLength(int length)
          Set the length of this line.
 void setPaintChar(char paintChar)
          Set the paintChar of this Line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

protected int length

paintChar

protected char paintChar
Constructor Detail

Line

protected Line(int length,
               char paintChar)
Construct a Line.

Parameters:
length - length in (character) pixels.
paintChar - character used for painting this Line.
Method Detail

getLength

public int getLength()
Get the length of this line.

Returns:
the length in (character) pixels.

getPaintChar

public char getPaintChar()
Get the paintChar of this Line.

Returns:
the paintChar.

paintOn

public void paintOn(Screen s)
Paint this Line on Screen s at position (0,0).

Parameters:
s - the Screen on which this Line is to be painted.

paintOn

public abstract void paintOn(Screen s,
                             int x,
                             int y)
Paint this Line on Screen s at position (x,y).

Parameters:
s - the Screen on which this Line is to be painted.
x - the x position for the line.
y - the y position for the line.

setLength

public void setLength(int length)
Set the length of this line.

Parameters:
length - the new length in (character) pixels.

setPaintChar

public void setPaintChar(char paintChar)
Set the paintChar of this Line.

Parameters:
paintChar - the new paintChar.