| java.lang.Object java.awt.geom.Point2D java.awt.Point
Point | public class Point extends Point2D implements java.io.Serializable(Code) | | A point representing a location in
(x,y) coordinate space,
specified in integer precision.
version: 1.46, 05/05/07 author: Sami Shaio since: 1.0 |
Field Summary | |
public int | x The X coordinate of this Point . | public int | y The Y coordinate of this Point . |
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 boolean | equals(Object obj) Determines whether or not two points are equal. | public Point | getLocation() Returns the location of this point. | public double | getX() | public double | getY() | 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.
since: 1.1 |
Point | public Point(Point p)(Code) | | Constructs and initializes a point with the same location as
the specified Point object.
Parameters: p - a point since: 1.1 |
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 of the newly constructed Point Parameters: y - the Y coordinate of the newly constructed Point since: 1.0 |
equals | public boolean equals(Object obj)(Code) | | 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.
Parameters: obj - an object to be compared with this Point2D true if the object to be compared isan instance of Point2D and hasthe same values; false otherwise. |
getX | public double getX()(Code) | | since: 1.2 |
getY | public double getY()(Code) | | since: 1.2 |
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 See Also: java.awt.Component.setLocation(intint) |
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 |
|
|