    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.

##

Line()
  Constructs a new Line whose start point is at (0, 0), vector componet 0, and 0.
Line(int, int)
  Constructs a new Line whose start point is at (0, 0), vector componet delta_x, and delta_y
Line(int, int, int, int)
  Constructs a new Line whose start point is at (x, y), vector componet delta_x, and delta_y
Line(Point)
  Constructs a new rectangle whose start is the specified point argument and whose x, y components are 0, 0.
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

##

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

##

Line

      public Line()

  Constructs a new Line whose start point is at (0, 0), vector componet 0, and 0.

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

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

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

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

##

draw

      public void draw(Graphics g)

  draw this line

draw

      public void draw(Graphics g,
                       Color color)

  draw this line with color

endPoint

      public Point endPoint()

  Return a copy the end point.

length

      public int length()

  Return line length.
  Returns:
    length of this Line.

startPoint

      public Point startPoint()

  return a copy of start point.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index