public class Point extends Point2D implements Serializable
(x,y)坐标空间,以整数精度指定。
Point2D.Double, Point2D.Float| Modifier and Type | Field and Description |
|---|---|
int |
x
这个
Point的X
Point 。
|
int |
y
这个Y39的坐标是
Point 。
|
| Constructor and Description |
|---|
Point()
构造并初始化坐标空间原点(0,0)的点。
|
Point(int x, int y)
构造并初始化坐标空间中指定的
(x,y)位置的点。
|
Point(Point p)
构造和初始化与指定的
Point对象相同位置的点。
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
确定两点是否相等。
|
Point |
getLocation()
返回这一点的位置。
|
double |
getX()
返回这个
Point2D的X坐标在
double精度。
|
double |
getY()
返回这个
Point2D的Y坐标在
double精度。
|
void |
move(int x, int y)
将此点移动到
(x,y)坐标平面中的指定位置。
|
void |
setLocation(double x, double y)
将此点的位置设置为指定的双坐标。
|
void |
setLocation(int x, int y)
更改要具有指定位置的点。
|
void |
setLocation(Point p)
将点的位置设置为指定的位置。
|
String |
toString()
在
(x,y)坐标空间中返回此点及其位置的
(x,y)表示形式。
|
void |
translate(int dx, int dy)
转换这一点上,在位置
(x,y) ,由
dx沿
x轴和
dy沿
y轴线,使得其现在代表点
(x+dx,y+dy) 。
|
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocationpublic int x
Point 。
如果没有设置X坐标,它将默认为0。
getLocation() ,
move(int, int)
public int y
Point 。
如果没有设置Y坐标,则默认为0。
getLocation() ,
move(int, int)
public Point()
public Point(Point p)
Point对象相同位置的点。
p - 一点
public Point(int x,
int y)
(x,y)位置构建和初始化一个点。
x - 新构建的X坐标
Point
y - 新构建的Y坐标
Point
public double getX()
Point2D的X坐标在
double精度。
public double getY()
Point2D的Y坐标在
double精度。
public Point getLocation()
getLocation方法Component 。
Component.getLocation() ,
setLocation(java.awt.Point) ,
setLocation(int, int)
public void setLocation(Point p)
setLocation方法Component 。
p - 一点,这一点的新位置
Component.setLocation(java.awt.Point) ,
getLocation()
public void setLocation(int x,
int y)
包括此方法的完整性,并行setLocation方法Component 。 其行为与move(int, int) 。
x - 新位置的X坐标
y - 新位置的Y坐标
Component.setLocation(int, int) ,
getLocation() ,
move(int, int)
public void setLocation(double x,
double y)
Integer.MIN_VALUE将被重置为MIN_VALUE ,任何大于Integer.MAX_VALUE将被重置为MAX_VALUE 。
setLocation在
Point2D
x - 新位置的X坐标
y - 新位置的Y坐标
getLocation()
public void move(int x,
int y)
(x,y)坐标平面中的指定位置。
此方法与setLocation(int, int) 。
x - 新位置的X坐标
y - 新位置的Y坐标
Component.setLocation(int, int)
public void translate(int dx,
int dy)
(x,y) ,由
dx沿
x轴和
dy沿
y轴线,使得其现在代表点
(x+dx,y+dy) 。
dx - 沿X轴移动该点的距离
dy - 沿着Y轴移动该点的距离
public boolean equals(Object obj)
Point2D相等,当它们的值x个y成员字段,表示它们在坐标空间中的位置,是相同的。
equals在
Point2D
obj - 与此
Point2D进行比较的对象
true如果要比较的对象是一个Point2D的实例,并且具有相同的值;
false否则。
Object.hashCode() , HashMap
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.