- java.lang.Object
-
- java.awt.geom.RectangularShape
-
- java.awt.geom.Rectangle2D
-
- java.awt.geom.Rectangle2D.Double
-
- All Implemented Interfaces:
-
Shape,Serializable,Cloneable
- Enclosing class:
- Rectangle2D
public static class Rectangle2D.Double extends Rectangle2D implements Serializable
Double类定义了一个双坐标指定的矩形。- 从以下版本开始:
- 1.2
- 另请参见:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
-
-
Field Summary
Fields Modifier and Type Field 描述 doubleheight这个高度这Rectangle2D。doublewidth这个宽度Rectangle2D。doublex这个Rectangle2D的X坐标。doubley这个Rectangle2D的Y坐标。-
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
-
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 Rectangle2DcreateIntersection(Rectangle2D r)返回一个新的Rectangle2D对象,表示Rectangle2D与指定的Rectangle2D。Rectangle2DcreateUnion(Rectangle2D r)返回一个新的Rectangle2D对象,表示该Rectangle2D与指定的Rectangle2D。Rectangle2DgetBounds2D()返回Shape比getBounds方法更高精度和更准确的边界框。doublegetHeight()doubledoublegetWidth()以double精度返回成帧矩形的宽度。doublegetX()返回double精度的成帧矩形左上角的X坐标。doublegetY()返回double精度的框架矩形左上角的Y坐标。booleanisEmpty()确定RectangularShape是否为空。intoutcode(double x, double y)确定相对于该Rectangle2D指定坐标的Rectangle2D。voidsetRect(double x, double y, double w, double h)将此Rectangle2D的位置和大小设置为指定的double值。voidsetRect(Rectangle2D r)将此Rectangle2D设置为与指定的Rectangle2D相同。StringtoString()返回此Rectangle2D的String表示。-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
-
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
-
-
-
-
方法详细信息
-
getX
public double getX()
以double精度返回框架矩形左上角的X坐标。- Specified by:
-
getX在RectangularShape - 结果
- 框架矩形左上角的X坐标。
- 从以下版本开始:
- 1.2
-
getY
public double getY()
返回double精度的框架矩形左上角的Y坐标。- Specified by:
-
getY中的RectangularShape - 结果
- 框架矩形左上角的Y坐标。
- 从以下版本开始:
- 1.2
-
getWidth
public double getWidth()
返回double精度的成帧矩形的宽度。- Specified by:
-
getWidth在RectangularShape - 结果
- 框架矩形的宽度。
- 从以下版本开始:
- 1.2
-
getHeight
public double getHeight()
以double精度返回框架矩形的高度。- Specified by:
-
getHeight在RectangularShape - 结果
- 框架矩形的高度。
- 从以下版本开始:
- 1.2
-
isEmpty
public boolean isEmpty()
确定RectangularShape是否为空。 当RectangularShape为空时,不包含任何区域。- Specified by:
-
isEmpty在RectangularShape - 结果
-
true如果RectangularShape是空的; 否则为false。 - 从以下版本开始:
- 1.2
-
setRect
public void setRect(double x, double y, double w, double h)将此Rectangle2D的位置和大小设置为指定的double值。- Specified by:
-
setRect在Rectangle2D - 参数
-
x- 这个Rectangle2D左上角的X坐标 -
y- 这个Rectangle2D左上角的Y坐标 -
w- 这个Rectangle2D的宽度 -
h- 这个高度Rectangle2D - 从以下版本开始:
- 1.2
-
setRect
public void setRect(Rectangle2D r)
将此Rectangle2D设置为与指定的Rectangle2D相同。- 重写:
-
setRect在Rectangle2D - 参数
-
r- 指定的Rectangle2D - 从以下版本开始:
- 1.2
-
outcode
public int outcode(double x, double y)确定相对于该Rectangle2D指定坐标的Rectangle2D。 该方法计算适当掩码值的二进制OR,该值适用于该Rectangle2D每一侧,指定的坐标是否与该Rectangle2D的其余部分位于同一边。- Specified by:
-
outcode在Rectangle2D - 参数
-
x- 指定的X坐标 -
y- 指定的Y坐标 - 结果
- 所有适当输出代码的逻辑或。
- 从以下版本开始:
- 1.2
- 另请参见:
-
Rectangle2D.OUT_LEFT,Rectangle2D.OUT_TOP,Rectangle2D.OUT_RIGHT,Rectangle2D.OUT_BOTTOM
-
getBounds2D
public Rectangle2D getBounds2D()
返回Shape高精度和更准确的边框,比getBounds方法。 请注意,不保证返回的Rectangle2D是封闭的最小边界框Shape,只表示Shape完全在指定的范围内Rectangle2D。 此方法返回的边界框通常比getBounds方法返回的getBounds更小,因为溢出问题永远不会失败,因为返回值可以是使用双精度值存储维度的Rectangle2D的实例。请注意, definition of insideness可能导致shape定义轮廓上的
shape不能被视为包含在返回的bounds对象中的情况,但仅在这些点也未被包含在原始shape。如果
point是内部shape根据contains(point)方法,那么它必须是内部返回Rectangle2D界限根据对象contains(point)所述的方法bounds。 特别:shape.contains(p)需要bounds.contains(p)如果
point中没有shape,那么它可能仍然包含在bounds对象中:bounds.contains(p)并不表示shape.contains(p)- Specified by:
-
getBounds2D在接口Shape - 重写:
-
getBounds2D在Rectangle2D - 结果
-
的实例
Rectangle2D那是一个高精度边界框Shape。 - 从以下版本开始:
- 1.2
- 另请参见:
-
Shape.getBounds()
-
createIntersection
public Rectangle2D createIntersection(Rectangle2D r)
返回一个新的Rectangle2D对象,表示Rectangle2D与指定的Rectangle2D。- Specified by:
-
createIntersection在Rectangle2D - 参数
-
r-在Rectangle2D与此相交Rectangle2D - 结果
-
最大的
Rectangle2D包含在指定的Rectangle2D和在这Rectangle2D。 - 从以下版本开始:
- 1.2
-
createUnion
public Rectangle2D createUnion(Rectangle2D r)
返回一个新的Rectangle2D对象,表示该Rectangle2D与指定的Rectangle2D。- Specified by:
-
createUnion在Rectangle2D - 参数
-
r-在Rectangle2D与此相结合Rectangle2D - 结果
-
最小的
Rectangle2D包含指定的Rectangle2D和Rectangle2D。 - 从以下版本开始:
- 1.2
-
-