|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectacm.graphics.GPoint
public class GPoint
This class is a double-precision version of the Point class
in java.awt.
| Constructor Summary | |
|---|---|
GPoint()
Constructs a new GPoint at the origin (0, 0). |
|
GPoint(double x,
double y)
Constructs a new GPoint with the specified coordinates. |
|
GPoint(GPoint p)
Constructs a new GPoint from an existing one. |
|
GPoint(Point p)
Constructs a new GPoint from an existing AWT Point. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
Tests whether two GPoint objects are equal. |
GPoint |
getLocation()
Returns a new GPoint whose coordinates are the same as this one. |
double |
getX()
Returns the x coordinate of this GPoint. |
double |
getY()
Returns the y coordinate of this GPoint. |
int |
hashCode()
Returns an integer hash code for the point. |
void |
setLocation(double x,
double y)
Sets the location of the GPoint to the specified x
and y values. |
void |
setLocation(GPoint p)
Sets the location of the GPoint to that of an existing one. |
Point |
toPoint()
Converts this GPoint to the nearest integer-based Point. |
String |
toString()
Converts this GPoint to its string representation. |
void |
translate(double dx,
double dy)
Adjusts the coordinates of a point by the specified dx and
dy offsets. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GPoint()
GPoint at the origin (0, 0).
public GPoint(double x,
double y)
GPoint with the specified coordinates.
x - The x-coordinate of the pointy - The y-coordinate of the pointpublic GPoint(GPoint p)
GPoint from an existing one.
p - The original pointpublic GPoint(Point p)
GPoint from an existing AWT Point.
p - An AWT Point| Method Detail |
|---|
public boolean equals(Object obj)
GPoint objects are equal.
Because floating-point values are inexact, this method checks for
equality by comparing the float values (rather than the
double values) of the coordinates.
equals in class Objectobj - Any object
true if the obj is a GPoint
equal to this one, and false otherwisepublic GPoint getLocation()
GPoint whose coordinates are the same as this one.
public double getX()
GPoint.
GPointpublic double getY()
GPoint.
GPointpublic int hashCode()
GPoint is constructed from the hash codes from the
float values of the coordinates, which are the ones used in the
equals method.
hashCode in class Object
public void setLocation(double x,
double y)
GPoint to the specified x
and y values.
x - The new x-coordinate for the pointy - The new y-coordinate for the pointpublic void setLocation(GPoint p)
GPoint to that of an existing one.
p - An existing GPoint specifying the new locationpublic Point toPoint()
GPoint to the nearest integer-based Point.
Pointpublic String toString()
GPoint to its string representation.
toString in class Object
public void translate(double dx,
double dy)
dx and
dy offsets.
dx - The change in the x direction (positive is rightward)dy - The change in the y direction (positive is downward)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||