public static class Rectangle2D.Float extends Rectangle2D implements Serializable
Float
类定义了一个矩形指定浮点坐标。
Rectangle2D.Double, Rectangle2D.Float
Modifier and Type | Field and Description |
---|---|
float |
height
这
Rectangle2D 高度。
|
float |
width
这
Rectangle2D 宽度。
|
float |
x
这
Rectangle2D X坐标。
|
float |
y
这
Rectangle2D Y坐标。
|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
Float()
构建了一种新的
Rectangle2D ,初始化位置(0, 0)和大小(0, 0)。
|
Float(float x, float y, float w, float h)
构造和初始化一个
Rectangle2D 从指定的
float 坐标。
|
Modifier and Type | Method and Description |
---|---|
Rectangle2D |
createIntersection(Rectangle2D r)
返回一个新的
Rectangle2D 对象表示与指定的
Rectangle2D 这
Rectangle2D 路口。
|
Rectangle2D |
createUnion(Rectangle2D r)
返回一个新的
Rectangle2D 表示这
Rectangle2D 与指定的
Rectangle2D 联盟。
|
Rectangle2D |
getBounds2D()
返回一个高的精度和更精确的包围盒的
Shape 比
getBounds 方法。
|
double |
getHeight()
返回框架矩形
double 精度高。
|
double |
getWidth()
返回框架矩形的宽度
double 精度。
|
double |
getX()
返回的
double 精度框架矩形左上角的x坐标。
|
double |
getY()
返回的
double 精度框架矩形左上角的Y坐标。
|
boolean |
isEmpty()
确定
RectangularShape 是空的。
|
int |
outcode(double x, double y)
确定指定的坐标是相对于这个
Rectangle2D 。
|
void |
setRect(double x, double y, double w, double h)
设置为指定值的位置
double 这
Rectangle2D 和大小。
|
void |
setRect(float x, float y, float w, float h)
设置为指定值的位置
float 这
Rectangle2D 和大小。
|
void |
setRect(Rectangle2D r)
设置为指定的
Rectangle2D 同这
Rectangle2D 。
|
String |
toString()
返回该
Rectangle2D 的
String 表示。
|
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
public float x
Rectangle2D
X坐标。
public float y
Rectangle2D
Y坐标。
public float width
Rectangle2D
宽度。
public float height
Rectangle2D
高度。
public Float()
Rectangle2D
,初始化位置(0, 0)和大小(0, 0)。
public Float(float x, float y, float w, float h)
Rectangle2D
从指定的
float
坐标。
x
-对新构建的
Rectangle2D
左上角的x坐标
y
-对新构建的
Rectangle2D
左上角的Y坐标
w
-新建
Rectangle2D
宽度
h
-新建
Rectangle2D
高度
public double getX()
double
精度框架矩形左上角的x坐标。
getX
方法重写,继承类
RectangularShape
public double getY()
double
精度框架矩形左上角的Y坐标。
getY
方法重写,继承类
RectangularShape
public double getWidth()
double
精度。
getWidth
方法重写,继承类
RectangularShape
public double getHeight()
double
精度高。
getHeight
方法重写,继承类
RectangularShape
public boolean isEmpty()
RectangularShape
是空的。当
RectangularShape
是空的,它包含的任何地区。
isEmpty
方法重写,继承类
RectangularShape
true
如果
RectangularShape
是空的;
false
否则。
public void setRect(float x, float y, float w, float h)
float
这
Rectangle2D
和大小。
x
-这
Rectangle2D
左上角的x坐标
y
-这
Rectangle2D
左上角的Y坐标
w
-这
Rectangle2D
宽度
h
-这
Rectangle2D
高度
public void setRect(double x, double y, double w, double h)
double
这
Rectangle2D
和大小。
setRect
方法重写,继承类
Rectangle2D
x
-这
Rectangle2D
左上角的x坐标
y
-这
Rectangle2D
左上角的Y坐标
w
-这
Rectangle2D
宽度
h
-这
Rectangle2D
高度
public void setRect(Rectangle2D r)
Rectangle2D
同这
Rectangle2D
。
setRect
方法重写,继承类
Rectangle2D
r
-指定
Rectangle2D
public int outcode(double x, double y)
Rectangle2D
。这种方法计算出一个二进制或合适的掩码值指示,为本
Rectangle2D
每边,是否指定的坐标是在边缘的同侧,这
Rectangle2D
休息。
outcode
方法重写,继承类
Rectangle2D
x
-指定的X坐标
y
-指定的y坐标
Rectangle2D.OUT_LEFT
,
Rectangle2D.OUT_TOP
,
Rectangle2D.OUT_RIGHT
,
Rectangle2D.OUT_BOTTOM
public Rectangle2D getBounds2D()
Shape
比
getBounds
方法。需要注意的是不能保证返回的
Rectangle2D
是最小包围盒包围
Shape
,只有
Shape
完全在于在显示
Rectangle2D
。包围盒返回此方法通常是更严格的比
getBounds
返回的方法,永远不会失败由于溢出的问题由于返回值可以使用双精度值存储维度的
Rectangle2D
实例。
请注意, definition of insideness可导致的情况下,点上的shape
定义轮廓可能不被视为包含在返回的bounds
对象,但只有在这些点的情况下,也不被认为是包含在原始的shape
。
如果一个point
在shape
根据contains(point)
方法,那么它必须在返回的Rectangle2D
界根据的bounds
contains(point)
方法的具体对象:
shape.contains(p)
需要bounds.contains(p)
如果一个point
是不是在shape
,那么它可能仍然包含在bounds
对象:
bounds.contains(p)
并不意味着shape.contains(p)
getBounds2D
接口
Shape
getBounds2D
方法重写,继承类
Rectangle2D
Rectangle2D
包围盒的
Shape
实例。
Shape.getBounds()
public Rectangle2D createIntersection(Rectangle2D r)
Rectangle2D
对象表示与指定的
Rectangle2D
这
Rectangle2D
路口。
createIntersection
方法重写,继承类
Rectangle2D
r
-
Rectangle2D
是相交的这
Rectangle2D
Rectangle2D
在这
Rectangle2D
中最大的
Rectangle2D
。
public Rectangle2D createUnion(Rectangle2D r)
Rectangle2D
表示这
Rectangle2D
与指定的
Rectangle2D
联盟。
createUnion
方法重写,继承类
Rectangle2D
r
-
Rectangle2D
要结合本
Rectangle2D
Rectangle2D
包含指定的
Rectangle2D
这
Rectangle2D
。
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.