Class ncsa.horizon.awt.Line
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.awt.Line

java.lang.Object
   |
   +----java.awt.Rectangle
           |
           +----ncsa.horizon.awt.Line

public class Line
extends Rectangle
Line class is a geometry entity represent a line segment vector with start point and x, y vector components.

Now, it just extends java.awt.Rectangle with Rectangle's x, y as start point and width, height as x, y vector components.

Since it extends Rectangle, outside objects have access to (x, y), which is the start point of the Line, and width, height which are the x, y components of the line.


Constructor Index

 o Line()
Constructs a new Line whose start point is at (0, 0), vector componet 0, and 0.
 o Line(int, int)
Constructs a new Line whose start point is at (0, 0), vector componet delta_x, and delta_y
 o Line(int, int, int, int)
Constructs a new Line whose start point is at (x, y), vector componet delta_x, and delta_y
 o Line(Point)
Constructs a new rectangle whose start is the specified point argument and whose x, y components are 0, 0.
 o Line(Point, int, int)
Constructs a new rectangle whose start is the specified point argument and whose x, y components are delta_x, delta_y

Method Index

 o draw(Graphics)
draw this line
 o draw(Graphics, Color)
draw this line with color
 o endPoint()
Return a copy the end point.
 o length()
Return line length.
 o startPoint()
return a copy of start point.

Constructors

 o Line
  public Line()
Constructs a new Line whose start point is at (0, 0), vector componet 0, and 0.
 o Line
  public Line(int delta_x,
              int delta_y)
Constructs a new Line whose start point is at (0, 0), vector componet delta_x, and delta_y
Parameters:
delta_x - the Line's x component
delta_y - the Line's y component
 o Line
  public Line(int x,
              int y,
              int delta_x,
              int delta_y)
Constructs a new Line whose start point is at (x, y), vector componet delta_x, and delta_y
Parameters:
x - the x coordinate of start point
y - the y coordinate of start point
delta_x - the Line's x component
delta_y - the Line's y component
 o Line
  public Line(Point p)
Constructs a new rectangle whose start is the specified point argument and whose x, y components are 0, 0.
Parameters:
p - start point
 o Line
  public Line(Point p,
              int delta_x,
              int delta_y)
Constructs a new rectangle whose start is the specified point argument and whose x, y components are delta_x, delta_y
Parameters:
p - start point
delta_x - the Line's x component
delta_y - the Line's y component

Methods

 o draw
  public void draw(Graphics g)
draw this line
 o draw
  public void draw(Graphics g,
                   Color color)
draw this line with color
 o endPoint
  public Point endPoint()
Return a copy the end point.
 o length
  public int length()
Return line length.
Returns:
length of this Line.
 o startPoint
  public Point startPoint()
return a copy of start point.

All Packages  Class Hierarchy  This Package  Previous  Next  Index