public class Point extends Point2D implements Serializable
(x,y)坐标空间中的位置,指定整数精度。
Point2D.Double, Point2D.Float| 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()
返回x坐标本
Point2D在
double精度。
|
double |
getY()
返回
double精度这
Point2D Y坐标。
|
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)坐标空间位置。
|
void |
translate(int dx, int dy)
翻译这一点,在
(x,y)的位置,沿
x轴和
dy沿
y轴
dx所以它现在代表点
(x+dx,y+dy)。
|
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocationpublic int x
Point X坐标。如果没有X坐标设置,它将默认为0。
getLocation(),
move(int, int)
public int y
Point Y坐标。如果没有Y坐标设置默认为0。
getLocation(),
move(int, int)
public Point()
public Point(Point p)
Point对象相同的初始化一个点。
p一点
public Point(int x,
int y)
(x,y)位置在坐标空间。
x -新建
Point X坐标
y -新建
Point Y坐标
public double getX()
Point2D在
double精度。
public double getY()
double精度这
Point2D Y坐标。
public Point getLocation()
Component的
getLocation方法。
Component.getLocation(),
setLocation(java.awt.Point),
setLocation(int, int)
public void setLocation(Point p)
Component的
setLocation方法。
p -一个点,这个点的新位置
Component.setLocation(java.awt.Point),
getLocation()
public void setLocation(int x,
int y)
该方法包括完整性、平行Component的setLocation方法。它的行为是相同的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)的位置,沿
x轴和
dy沿
y轴
dx所以它现在代表点
(x+dx,y+dy)。
dx -移动此点沿X轴的距离
dy -沿Y轴移动这个点的距离
public boolean equals(Object obj)
x和
y成员字段的值
Point2D两实例相等,代表自己的坐标空间中的位置,都是一样的。
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.