| 
 | JavaTM 2 Platform Standard Ed. 5.0 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.geom.Point2D
java.awt.Point
public class Point
表示 (x, y) 坐标空间中的位置的点,以整数精度来指定。
| 嵌套类摘要 | 
|---|
| 从类 java.awt.geom.Point2D 继承的嵌套类/接口 | 
|---|
| Point2D.Double, Point2D.Float | 
| 字段摘要 | |
|---|---|
|  int | xx 坐标。 | 
|  int | yy 坐标。 | 
| 构造方法摘要 | |
|---|---|
| Point()在坐标空间的原点 (0,0) 构造并初始化一个点。 | |
| Point(int x,
      int y)在坐标空间中指定的 (x, y) 位置构造并初始化一个点。 | |
| Point(Point p)构造并初始化一个与指定的 Point对象具有相同位置的点。 | |
| 方法摘要 | |
|---|---|
|  boolean | equals(Object obj)确定两个点是否相等。 | 
|  Point | getLocation()返回此点的位置。 | 
|  double | getX()以双精度型返回点的 X 坐标。 | 
|  double | getY()以双精度型返回点的 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 轴平移 dx,沿 y 轴平移dy,移动后得到点 (x+dx,y+dy)。 | 
| 从类 java.awt.geom.Point2D 继承的方法 | 
|---|
| clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| finalize, getClass, notify, notifyAll, wait, wait, wait | 
| 字段详细信息 | 
|---|
public int x
getLocation(), 
move(int, int)public int y
getLocation(), 
move(int, int)| 构造方法详细信息 | 
|---|
public Point()
public Point(Point p)
Point 对象具有相同位置的点。
p - 点
public Point(int x,
             int y)
x - x 坐标y - y 坐标| 方法详细信息 | 
|---|
public double getX()
public double getY()
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。
Point2D 中的 setLocationx - 新位置的 x 坐标y - 新位置的 y 坐标getLocation()
public void move(int x,
                 int y)
setLocation(int, int) 相同。
x - 新位置的 x 坐标y - 新位置的 y 坐标Component.setLocation(int, int)
public void translate(int dx,
                      int dy)
dx,沿 y 轴平移 dy,移动后得到点 (x + dx, y + dy)。
dx - 沿 x 轴平移此点的距离dy - 沿 y 轴平移此点的距离public boolean equals(Object obj)
Point2D 的两个实例的 x 和 y 成员字段的值相同,则它们是相等的,其中成员字段的值表示实例在坐标空间中的位置。
obj - 要与此 Point2D 的实例进行比较的对象
Point2D 的实例且有相同的值,则返回 true;否则返回 false。Object.hashCode(), 
Hashtablepublic String toString()
null。
| 
 | JavaTM 2 Platform Standard Ed. 5.0 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。