psgraphics
Class DrawableLine

java.lang.Object
  extended bypsgraphics.Figure
      extended bypsgraphics.DrawableLine

public class DrawableLine
extends Figure

Represents a line that can be drawn to the screen. The parameters fromX, fromY describe the starting coordinates and the parameters toX, toY describe the ending coordinates.


Constructor Summary
DrawableLine(int fromX, int fromY, int toX, int toY)
          Creates a new DrawableLine and initializes the coordinates which describe it.
 
Method Summary
 void draw(java.awt.Graphics g)
          Draws the line on the drawing area of the postscript interpreter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawableLine

public DrawableLine(int fromX,
                    int fromY,
                    int toX,
                    int toY)
Creates a new DrawableLine and initializes the coordinates which describe it.

Parameters:
fromX - Starting X.
fromY - Starting Y.
toX - Ending X.
toY - Endint Y.
Method Detail

draw

public void draw(java.awt.Graphics g)
Draws the line on the drawing area of the postscript interpreter.

Precondition : Must be called by the paint method of the component it draws on and given the same Graphics parameter.
Postcondition : The figure will be drawn on the drawing area.

Specified by:
draw in class Figure
Parameters:
g - The same Graphics parameter passed to the paint method of the drawing area.