java.awt.geom
Class Line2D.Double

java.lang.Object
  extended by java.awt.geom.Line2D
      extended by java.awt.geom.Line2D.Double
All Implemented Interfaces:
Shape, Cloneable
Enclosing class:
Line2D

public static class Line2D.Double
extends Line2D

This class defines a point in double precision.

Since:
1.2

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Line2D
Line2D.Double, Line2D.Float
 
Field Summary
 double x1
          The x coordinate of the first point.
 double x2
          The x coordinate of the second point.
 double y1
          The y coordinate of the first point.
 double y2
          The y coordinate of the second point.
 
Constructor Summary
Line2D.Double()
          Construct the line segment (0,0)->(0,0).
Line2D.Double(double x1, double y1, double x2, double y2)
          Construct the line segment with the specified points.
Line2D.Double(Point2D p1, Point2D p2)
          Construct the line segment with the specified points.
 
Method Summary
 Rectangle2D getBounds2D()
          Return the exact bounds of this line segment.
 Point2D getP1()
          Return the first point.
 Point2D getP2()
          Return the second point.
 double getX1()
          Return the x coordinate of the first point.
 double getX2()
          Return the x coordinate of the second point.
 double getY1()
          Return the y coordinate of the first point.
 double getY2()
          Return the y coordinate of the second point.
 void setLine(double x1, double y1, double x2, double y2)
          Set this line to the given points.
 
Methods inherited from class java.awt.geom.Line2D
clone, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x1

public double x1
The x coordinate of the first point.


y1

public double y1
The y coordinate of the first point.


x2

public double x2
The x coordinate of the second point.


y2

public double y2
The y coordinate of the second point.

Constructor Detail

Line2D.Double

public Line2D.Double()
Construct the line segment (0,0)->(0,0).


Line2D.Double

public Line2D.Double(double x1,
                     double y1,
                     double x2,
                     double y2)
Construct the line segment with the specified points.

Parameters:
x1 - the x coordinate of the first point
y1 - the y coordinate of the first point
x2 - the x coordinate of the second point
y2 - the y coordinate of the second point

Line2D.Double

public Line2D.Double(Point2D p1,
                     Point2D p2)
Construct the line segment with the specified points.

Parameters:
p1 - the first point
p2 - the second point
Throws:
NullPointerException - if either point is null
Method Detail

getX1

public double getX1()
Return the x coordinate of the first point.

Specified by:
getX1 in class Line2D
Returns:
the value of x1

getY1

public double getY1()
Return the y coordinate of the first point.

Specified by:
getY1 in class Line2D
Returns:
the value of y1

getP1

public Point2D getP1()
Return the first point.

Specified by:
getP1 in class Line2D
Returns:
the point (x1,y1)

getX2

public double getX2()
Return the x coordinate of the second point.

Specified by:
getX2 in class Line2D
Returns:
the value of x2

getY2

public double getY2()
Return the y coordinate of the second point.

Specified by:
getY2 in class Line2D
Returns:
the value of y2

getP2

public Point2D getP2()
Return the second point.

Specified by:
getP2 in class Line2D
Returns:
the point (x2,y2)

setLine

public void setLine(double x1,
                    double y1,
                    double x2,
                    double y2)
Set this line to the given points.

Specified by:
setLine in class Line2D
Parameters:
x1 - the new x coordinate of the first point
y1 - the new y coordinate of the first point
x2 - the new x coordinate of the second point
y2 - the new y coordinate of the second point

getBounds2D

public Rectangle2D getBounds2D()
Return the exact bounds of this line segment.

Returns:
the bounding box
See Also:
Shape.getBounds()