is new.
java.lang.Objectjava.awt.geom.Point2D
java.awt.Point
public class Point
A point representing a location in
(x,y)
(x, y)
coordinate space, specified in integer precision.
1.0
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.awt.geom. Point2D |
|---|
| Point2D.Double , Point2D.Float |
| Field Summary | |
|---|---|
| int |
x
The
X coordinate of this Point.
|
| int |
y
The
Y coordinate of this Point.
|
| Constructor Summary | |
|---|---|
|
Point
() Constructs and initializes a point at the origin (0, 0) of the coordinate space. |
|
|
Point
(int x, int y) Constructs and initializes a point at the specified
(x,y)
|
|
|
Point
(
Point
p) Constructs and initializes a point with the same location as the specified Point object. |
|
| Method Summary | |
|---|---|
| boolean |
equals
(
Object
obj) Determines whether or not two points are equal. |
| Point |
getLocation
() Returns the location of this point. |
| double |
getX
() Returns the X coordinate of
this Point2D
|
| double |
getY
() Returns the Y coordinate of
this Point2D
|
| void |
move
(int x, int y) Moves this point to the specified location in the
(x,y)
|
| void |
setLocation
(double x, double y) Sets the location of this point to the specified double coordinates. |
| void |
setLocation
(int x, int y) Changes the point to have the specified location. |
| void |
setLocation
(
Point
p) Sets the location of the point to the specified location. |
| String |
toString
() Returns a string representation of this point and its location in the
(x,y)
|
| void |
translate
(int dx, int dy) Translates this point, at location
(x,y),
(x+dx,y+dy).
|
| Methods inherited from class java.awt.geom. Point2D |
|---|
| clone , distance , distance , distance , distanceSq , distanceSq , distanceSq , hashCode , setLocation |
| Methods inherited from class java.lang. Object |
|---|
| finalize , getClass , notify , notifyAll , wait , wait , wait |
| Field Detail |
|---|
public int x
X coordinate of this Point.
X
Since:
1.0
public int y
Y coordinate of this Point.
Y
Since:
1.0
| Constructor Detail |
|---|
public Point()
1.1
public Point(Point p)
1.1
public Point(int x,
int y)
(x,y)
x - the X coordinate of the newly constructed Point
y - the Y coordinate of the newly constructed Point
Since:
1.0
| Method Detail |
|---|
public double getX()
this Point2D
the X coordinate of this Point2D.
Since:
1.2
public double getY()
this Point2D
the Y coordinate of this Point2D.
Since:
1.2
public Point getLocation()
1.1
public void setLocation(Point p)
1.1
public void setLocation(int x,
int y)
This method is included for completeness, to parallel the setLocation method of Component. Its behavior is identical with move(int, int).
X
Y
1.1
public void setLocation(double x,
double y)
X
Y
public void move(int x,
int y)
(x,y)
X
Y
public void translate(int dx,
int dy)
(x,y),
(x+dx,y+dy).
X
Y
public boolean equals(Object obj)
public String toString()
(x,y)