- java.lang.Object
-
- java.awt.geom.RectangularShape
-
- java.awt.geom.Rectangle2D
-
- java.awt.geom.Rectangle2D.Double
-
- 实现的所有接口
-
Shape,Serializable,Cloneable
- Enclosing class:
- Rectangle2D
public static class Rectangle2D.Double extends Rectangle2D implements Serializable
Double类定义以双坐标指定的矩形。- 从以下版本开始:
- 1.2
- 另请参见:
- Serialized Form
-
-
嵌套类汇总
-
嵌套类/接口声明在类 java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
-
-
字段汇总
字段 变量和类型 字段 描述 doubleheight这个高度Rectangle2D。doublewidth这个宽度Rectangle2D。doublex此Rectangle2D的X坐标。doubley这个Rectangle2D的Y坐标。-
声明的属性在类 java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
-
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 Rectangle2DcreateIntersection(Rectangle2D r)返回一个新的Rectangle2D对象,表示此Rectangle2D与指定的Rectangle2D。Rectangle2DcreateUnion(Rectangle2D r)返回一个新的Rectangle2D对象,表示此Rectangle2D与指定的Rectangle2D。Rectangle2DgetBounds2D()返回Shape高精度和更精确的边界框,而不是getBounds方法。doublegetHeight()以double精度返回框架矩形的高度。doublegetWidth()以double精度返回框架矩形的宽度。doublegetX()以double精度返回框架矩形左上角的X坐标。doublegetY()以double精度返回框架矩形左上角的Y坐标。booleanisEmpty()确定RectangularShape是否为空。intoutcode(double x, double y)确定指定坐标相对于此Rectangle2D。voidsetRect(double x, double y, double w, double h)将此Rectangle2D的位置和大小设置为指定的double值。voidsetRect(Rectangle2D r)将此Rectangle2D设置为与指定的Rectangle2D相同。StringtoString()返回此Rectangle2D的String表示。-
声明方法的类 java.awt.geom.Rectangle2D
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
-
声明方法的类 java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
-
-
-
-
构造方法详细信息
-
Double
public Double()
构造一个新的Rectangle2D,初始化为位置(0,0)和大小(0,0)。- 从以下版本开始:
- 1.2
-
Double
public Double(double x, double y, double w, double h)构造并初始化一个Rectangle2D从指定double坐标。- 参数
-
x- 新构造的Rectangle2D左上角的X坐标 -
y- 新构造的Rectangle2D左上角的Y坐标 -
w- 新构造的Rectangle2D的宽度 -
h- 新建造的高度Rectangle2D - 从以下版本开始:
- 1.2
-
-
方法详细信息
-
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。 此方法计算适当的掩码值的二进制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方法返回的边界框更紧密,并且由于溢出问题而永远不会失败,因为返回值可以是使用双精度值来存储尺寸的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
-
-