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, setLocation
public 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.