| java.lang.Object org.awt.geom.Point2D org.awt.Point
Field Summary | |
public int | x The x coordinate. | public int | y The y coordinate. |
Constructor Summary | |
public | Point() Constructs and initializes a point at the origin
(0, 0) of the coordinate space. | public | Point(Point p) Constructs and initializes a point with the same location as
the specified Point object. | public | Point(int x, int y) Constructs and initializes a point at the specified
(x, y) location in the coordinate space. |
Method Summary | |
public Object | clone() | public boolean | equals(Object obj) Determines whether or not two points are equal. | public Point | getLocation() Returns the location of this point. | public double | getX() Returns the X coordinate of the point in double precision. | public double | getY() Returns the Y coordinate of the point in double precision. | public void | move(int x, int y) Moves this point to the specified location in the
(x, y) coordinate plane. | public void | setLocation(Point p) Sets the location of the point to the specified location. | public void | setLocation(int x, int y) Changes the point to have the specified location. | public void | setLocation(double x, double y) Sets the location of this point to the specified double coordinates. | public String | toString() Returns a string representation of this point and its location
in the (x, y) coordinate space. | public void | translate(int dx, int dy) 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 ). |
Point | public Point()(Code) | | Constructs and initializes a point at the origin
(0, 0) of the coordinate space.
|
Point | public Point(Point p)(Code) | | Constructs and initializes a point with the same location as
the specified Point object.
Parameters: p - a point |
Point | public Point(int x, int y)(Code) | | Constructs and initializes a point at the specified
(x, y) location in the coordinate space.
Parameters: x - the x coordinate Parameters: y - the y coordinate |
equals | public boolean equals(Object obj)(Code) | | Determines whether or not two points are equal. Two instances of
Point are equal if the values of their
x and y member fields, representing
their position in the coordinate space, are the same.
Parameters: obj - an object to be compared with this Point true if the object to be compared isan instance of Point and hasthe same values; false otherwise. |
getLocation | public Point getLocation()(Code) | | Returns the location of this point.
This method is included for completeness, to parallel the
getLocation method of Component .
a copy of this point, at the same location |
getX | public double getX()(Code) | | Returns the X coordinate of the point in double precision.
the X coordinate of the point in double precision |
getY | public double getY()(Code) | | Returns the Y coordinate of the point in double precision.
the Y coordinate of the point in double precision |
move | public void move(int x, int y)(Code) | | Moves this point to the specified location in the
(x, y) coordinate plane. This method
is identical with setLocation(int, int) .
Parameters: x - the x coordinate of the new location Parameters: y - the y coordinate of the new location |
setLocation | public void setLocation(Point p)(Code) | | Sets the location of the point to the specified location.
This method is included for completeness, to parallel the
setLocation method of Component .
Parameters: p - a point, the new location for this point |
setLocation | public void setLocation(int x, int y)(Code) | | 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) .
Parameters: x - the x coordinate of the new location Parameters: y - the y coordinate of the new location |
setLocation | public void setLocation(double x, double y)(Code) | | 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 .
Parameters: x - the x coordinate of the new location Parameters: y - the y coordinate of the new location See Also: Point.getLocation |
toString | public String toString()(Code) | | 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 .
a string representation of this point |
translate | public void translate(int dx, int dy)(Code) | | 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 ).
Parameters: dx - the distance to move this point along the x axis Parameters: dy - the distance to move this point along the y axis |
|
|