java.awt
public class Point extends Point2D implements Serializable
There are some public fields; if you mess with them in an inconsistent manner, it is your own fault when you get invalid results. Also, this class is not threadsafe.
Since: 1.0
UNKNOWN: updated to 1.4
Field Summary | |
---|---|
int | x
The x coordinate.
|
int | y
The y coordinate.
|
Constructor Summary | |
---|---|
Point()
Initializes a new instance of Point representing the
coordinates (0, 0).
| |
Point(Point p)
Initializes a new instance of Point with coordinates
identical to the coordinates of the specified point.
| |
Point(int x, int y)
Initializes a new instance of Point with the specified
coordinates.
|
Method Summary | |
---|---|
boolean | equals(Object obj)
Tests whether or not this object is equal to the specified object.
|
Point | getLocation()
Returns the location of this point. |
double | getX()
Get the x coordinate.
|
double | getY()
Get the y coordinate.
|
void | move(int x, int y)
Sets this object's coordinates to the specified values. |
void | setLocation(Point p)
Sets this object's coordinates to match those of the specified point.
|
void | setLocation(int x, int y)
Sets this object's coordinates to the specified values. |
void | setLocation(double x, double y)
Sets this object's coordinates to the specified values. |
String | toString()
Returns a string representation of this object. |
void | translate(int dx, int dy)
Changes the coordinates of this point such that the specified
dx parameter is added to the existing X coordinate and
dy is added to the existing Y coordinate.
|
Serial: the X coordinate of the point
See Also: getLocation Point
Serial: The Y coordinate of the point
See Also: getLocation Point
Point
representing the
coordinates (0, 0).
Since: 1.1
Point
with coordinates
identical to the coordinates of the specified point.
Parameters: p the point to copy the coordinates from
Throws: NullPointerException if p is null
Point
with the specified
coordinates.
Parameters: x the X coordinate y the Y coordinate
Parameters: obj the object to test against for equality
Returns: true if the specified object is equal
Returns: a copy of this point
Since: 1.1
See Also: setLocation
Returns: the value of x, as a double
Returns: the value of y, as a double
setLocation(int, int)
method.
Parameters: x the new X coordinate y the new Y coordinate
Parameters: p the point to copy the coordinates from
Throws: NullPointerException if p is null
Since: 1.1
move()
method.
Parameters: x the new X coordinate y the new Y coordinate
Parameters: x the new X coordinate y the new Y coordinate
getClass().getName() + "[x=" + x + ",y=" + y + ']'
.
Returns: a string representation of this object
dx
parameter is added to the existing X coordinate and
dy
is added to the existing Y coordinate.
Parameters: dx the amount to add to the X coordinate dy the amount to add to the Y coordinate