| Methods |
| public boolean |
equals(Object obj) Details
Determines whether or not two points are equal. Two instances of
Point2D are equal if the values of their
x and y member fields, representing
their position in the coordinate space, are the same.
| obj | an object to be compared with this Point2D |
| return | true if the object to be compared is
an instance of Point2D and has
the same values; false otherwise. |
|
| public void |
move(int x, int y) Details
Moves this point to the specified location in the
(x,y) coordinate plane. This method
is identical with setLocation(int, int).
| x | the X coordinate of the new location |
| y | the Y coordinate of the new location |
| See also | setLocation(int, int) |
|
| public String |
toString() Details
Returns a string representation of this point and its location
in the (x,y) coordinate space. This method is
intended to be used only for debugging purposes, and the content
and format of the returned string may vary between implementations.
The returned string may be empty but may not be null.
| return | a string representation of this point |
|
| public void |
translate(int dx, int dy) Details
Translates this point, at location (x,y),
by dx along the x axis and dy
along the y axis so that it now represents the point
(x+dx,y+dy).
| dx | the distance to move this point
along the X axis |
| dy | the distance to move this point
along the Y axis |
|
| Properties |
| public void |
setLocation(Point p) Details
Sets the location of the point to the specified location.
This method is included for completeness, to parallel the
setLocation method of Component.
|
| public void |
setLocation(int x, int y) Details
Changes the point to have the specified location.
This method is included for completeness, to parallel the
setLocation method of Component.
Its behavior is identical with move(int, int).
|
| public void |
setLocation(double x, double y) Details
Sets the location of this point to the specified double coordinates.
The double values will be rounded to integer values.
Any number smaller than Integer.MIN_VALUE
will be reset to MIN_VALUE, and any number
larger than Integer.MAX_VALUE will be
reset to MAX_VALUE.
| x | the X coordinate of the new location |
| y | the Y coordinate of the new location |
| See also | getLocation |
|
| public Point |
getLocation() Details
Returns the location of this point.
This method is included for completeness, to parallel the
getLocation method of Component.
|
| public double |
getX() Details
Returns the X coordinate of this Point2D in
double precision.
|
| public double |
getY() Details
Returns the Y coordinate of this Point2D in
double precision.
|