yu.ac.bg.etf.javaqx.qswing.graphics
Class Line

java.lang.Object
  extended byyu.ac.bg.etf.javaqx.qswing.graphics.Line
All Implemented Interfaces:
Shape

public class Line
extends java.lang.Object
implements Shape

Line Shape.

Version:
0.2.0
Author:
Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)

Nested Class Summary
protected static class Line.LinePathIterator
          Line Path Iterator.
 
Constructor Summary
Line()
          Constructs new Line object.
Line(int x1, int y1, int x2, int y2)
          Constructs new Line object.
Line(Point p1, Point p2)
          Constructs new Line object.
 
Method Summary
 boolean contains(int x, int y)
          Returns true if the specified coordinates lie in the shape.
 boolean equals(java.lang.Object obj)
          
 Rectangle getBounds()
          Returns a rectangle that completely encloses the shape.
 PathIterator getPathIterator()
          Returns path iterator that traverses the geometry of the Shape.
 int getX1()
          Returns the x coordinate of the first point.
 int getX2()
          Returns the x coordinate of the second point.
 int getY1()
          Returns the y coordinate of the first point.
 int getY2()
          Returns the y coordinate of the second point.
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Line

public Line()
Constructs new Line object.


Line

public Line(int x1,
            int y1,
            int x2,
            int y2)
Constructs new Line object.

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

Line

public Line(Point p1,
            Point p2)
Constructs new Line object.

Parameters:
p1 - the first point
p2 - the second point
Throws:
java.lang.IllegalArgumentException - is p1 or p2 is null
Method Detail

getX1

public int getX1()
Returns the x coordinate of the first point.

Returns:
the x coordinate of the first point

getY1

public int getY1()
Returns the y coordinate of the first point.

Returns:
the y coordinate of the first point

getX2

public int getX2()
Returns the x coordinate of the second point.

Returns:
the x coordinate of the second point

getY2

public int getY2()
Returns the y coordinate of the second point.

Returns:
the y coordinate of the second point

contains

public boolean contains(int x,
                        int y)
Returns true if the specified coordinates lie in the shape.

Specified by:
contains in interface Shape
Parameters:
x - the x coordinate
y - the y coordinate
Returns:
true if the specified coordinates lie in the shape

getBounds

public Rectangle getBounds()
Returns a rectangle that completely encloses the shape.

Specified by:
getBounds in interface Shape
Returns:
a rectangle that completely encloses the shape

getPathIterator

public PathIterator getPathIterator()
Returns path iterator that traverses the geometry of the Shape.

Specified by:
getPathIterator in interface Shape
Returns:
path iterator that traverses the geometry of the Shape

equals

public boolean equals(java.lang.Object obj)


hashCode

public int hashCode()


toString

public java.lang.String toString()



Copyright © 2007 ETF and contributors. All Rights Reserved.