| java.lang.Object java.awt.Point
Point | public class Point implements java.io.Serializable,Cloneable(Code) | | The Point class represents a location in a
two-dimensional (x, y) coordinate space.
version: 1.18, 08/19/02 author: Sami Shaio since: JDK1.0 |
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() Creates a new object of the same class and with the
same contents as this object. | public boolean | equals(Object obj) Determines whether two points are equal. | public Point | getLocation() Returns the location of this point. | public int | hashCode() Returns the hashcode for this point. | public void | move(int x, int y) Moves this point to the specificed location in the
(x, y) coordinate plane. | public void | setLocation(Point p) Sets the location of the point to the specificed location. | public void | setLocation(int x, int y) Changes the point to have the specificed location. | public String | toString() Returns a representation of this point and its location
in the (x, y) coordinate space as a string. | public void | translate(int x, int y) 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 ). |
x | public int x(Code) | | The x coordinate.
since: JDK1.0 |
y | public int y(Code) | | The y coordinate.
since: JDK1.0 |
Point | public Point()(Code) | | Constructs and initializes a point at the origin
(0, 0) of the coordinate space.
Parameters: x - the x coordinate. Parameters: y - the y coordinate. since: JDK1.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: JDK1.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. Parameters: y - the y coordinate. since: JDK1.0 |
clone | public Object clone()(Code) | | Creates a new object of the same class and with the
same contents as this object.
a clone of this instance. exception: OutOfMemoryError - if there is not enough memory. See Also: java.lang.Cloneable since: 1.2 |
equals | public boolean equals(Object obj)(Code) | | Determines whether 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. since: JDK1.0 |
hashCode | public int hashCode()(Code) | | Returns the hashcode for this point.
a hash code for this point. since: JDK1.0 |
move | public void move(int x, int y)(Code) | | Moves this point to the specificed 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) since: JDK1.0 |
toString | public String toString()(Code) | | Returns a representation of this point and its location
in the (x, y) coordinate space as a string.
a string representation of this point, including the values of its member fields. since: JDK1.0 |
translate | public void translate(int x, int y)(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. since: JDK1.0 |
|
|