|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaclib.Point
public class Point
This class hides the class java.awt.Point
in order
to implement QuickDraw-like definitions for points.
Implements also object methods for these points.
MacLib
,
Point
Field Summary | |
---|---|
short |
h
The x coordinate, as named in QuickDraw. |
short |
v
The y coordinate, as named in QuickDraw. |
Constructor Summary | |
---|---|
Point()
Constructs and initializes a point at coordinates (0,0) . |
|
Point(int h,
int v)
Constructs and initializes a point at the given coordinates. |
Method Summary | |
---|---|
Point |
addPt(Point p)
Translates this point by the displacement vector specified as the given point. |
boolean |
equalPt(Point pt)
Determines whether this point and the given point have the same coordinates. |
boolean |
equalPt(java.awt.Point pt)
Determines whether this point and the given point have the same coordinates. |
java.awt.Point |
getPoint()
Converts this point as a java.awt.Point object. |
int |
hashCode()
Returns a hash code for this point. |
boolean |
inRect(Rect r)
Determines whether the pixel below and to the right of this point is enclosed in the specified rectangle. |
Point |
setPt(int h,
int v)
Sets the coordinates of this point to the specified location. |
Point |
setPt(Point pt)
Sets the coordinates of this point as specified by the given Point object. |
Point |
setPt(java.awt.Point pt)
Sets the coordinates of this point as specified by the given java.awt.Point object. |
Point |
subPt(Point p)
Translates this point by the displacement vector specified as the inverse of the given point. |
java.lang.String |
toString()
Returns a string representation for the location of this point. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public short h
public short v
Constructor Detail |
---|
public Point()
(0,0)
.
public Point(int h, int v)
h
- the h coordinate of the new point.v
- the v coordinate of the new point.Method Detail |
---|
public java.awt.Point getPoint()
java.awt.Point
object.
Point
public Point setPt(int h, int v)
h
- the h coordinate of the new location.v
- the v coordinate of the new location.public Point setPt(Point pt)
Point
object.
pt
- the Point object used to specify the coordinates.public Point setPt(java.awt.Point pt)
java.awt.Point
object.
pt
- the java.awt.Point object that gives the coordinates.public Point addPt(Point p)
p
to the coordinates of this point.
p
- the Point object used as a vector to specify the
displacement.public Point subPt(Point p)
p
from the coordinates of this point.
p
- the Point object used as a vector to specify the
displacement.public boolean equalPt(Point pt)
pt
- the Point object to compare with.
true
if both points have same coordinates;
false
otherwise.public boolean equalPt(java.awt.Point pt)
pt
- the java.awt.Point
object to compare with.
true
if both points have same coordinates;
false
otherwise.Point
public boolean inRect(Rect r)
r
- the Rect object to check with.
true
if so; false
otherwise.Rect.ptInRect(Point)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |