Rectangle class defines a rectangle
with the specified size and location. By default the rectangle
has sharp corners. Rounded corners can be specified by setting both of
the arcWidth and arcHeight properties to positive values (> 0.0).
Example code: the following code creates a rectangle with 20 pixel rounded corners.
import javafx.scene.shape.*; Rectangle r = new Rectangle(); r.setX(50); r.setY(50); r.setWidth(200); r.setHeight(100); r.setArcWidth(20); r.setArcHeight(20);
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private DoubleProperty | arcHeight
Defines the vertical diameter of the arc at the four corners of the rectangle. |
| private DoubleProperty | arcWidth
Defines the horizontal diameter of the arc at the four corners of the rectangle. |
| private final DoubleProperty | height
Defines the height of the rectangle. |
| private static final int | |
| private final RoundRectangle2D | |
| private final DoubleProperty | width
Defines the width of the rectangle. |
| private DoubleProperty | x
Defines the X coordinate of the upper-left corner of the rectangle. |
| private DoubleProperty | y
Defines the Y coordinate of the upper-left corner of the rectangle. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Rectangle(double
width of the rectangle width, double height of the rectangle height)Creates a new instance of Rectangle with the given size. |
| public | |
| public | Rectangle(double
horizontal position of the rectangle x, double vertical position of the rectangle y, double width of the rectangle width, double height of the rectangle height)Creates a new instance of Rectangle with the given position and size. |
| Modifier and Type | Method and Description |
|---|---|
| public final DoubleProperty | |
| public final DoubleProperty | |
| pack-priv StrokeLineJoin | |
| private BaseBounds | |
| private RoundRectangle2D | |
| private NGNode | |
| private void | |
| public final double | |
| public final double | |
| public static List | Returns: theCssMetaDataHides javafx. Gets the |
| public List | getCssMetaData()
Overrides javafx. Implements javafx. This method should delegate to |
| public final double | |
| public final double | |
| public final double | |
| public final double | |
| public final DoubleProperty | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public String | Returns: a string representation of thisRectangle object.Overrides javafx. Returns a string representation of this |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty |
| arcHeight | back to summary |
|---|---|
| private DoubleProperty arcHeight Defines the vertical diameter of the arc at the four corners of the rectangle. The rectangle will have rounded corners if and only if both of the arc width and arc height properties are greater than 0.0.
| |
| arcWidth | back to summary |
|---|---|
| private DoubleProperty arcWidth Defines the horizontal diameter of the arc at the four corners of the rectangle. The rectangle will have rounded corners if and only if both of the arc width and arc height properties are greater than 0.0.
| |
| height | back to summary |
|---|---|
| private final DoubleProperty height Defines the height of the rectangle.
| |
| NON_RECTILINEAR_TYPE_MASK | back to summary |
|---|---|
| private static final int NON_RECTILINEAR_TYPE_MASK | |
| shape | back to summary |
|---|---|
| private final RoundRectangle2D shape | |
| width | back to summary |
|---|---|
| private final DoubleProperty width Defines the width of the rectangle.
| |
| x | back to summary |
|---|---|
| private DoubleProperty x Defines the X coordinate of the upper-left corner of the rectangle.
| |
| y | back to summary |
|---|---|
| private DoubleProperty y Defines the Y coordinate of the upper-left corner of the rectangle.
| |
| Rectangle | back to summary |
|---|---|
| public Rectangle() Creates an empty instance of Rectangle. | |
| Rectangle | back to summary |
|---|---|
| public Rectangle(double width, double height) Creates a new instance of Rectangle with the given size.
| |
| Rectangle | back to summary |
|---|---|
| public Rectangle(double width, double height, Paint fill) Creates a new instance of Rectangle with the given size and fill.
| |
| Rectangle | back to summary |
|---|---|
| public Rectangle(double x, double y, double width, double height) Creates a new instance of Rectangle with the given position and size.
| |
| arcHeightProperty | back to summary |
|---|---|
| public final DoubleProperty arcHeightProperty() | |
| arcWidthProperty | back to summary |
|---|---|
| public final DoubleProperty arcWidthProperty() | |
| convertLineJoin | back to summary |
|---|---|
| pack-priv StrokeLineJoin convertLineJoin(StrokeLineJoin t) Overrides javafx.
| |
| doComputeGeomBounds | back to summary |
|---|---|
| private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx) | |
| doConfigShape | back to summary |
|---|---|
| private RoundRectangle2D doConfigShape() | |
| doCreatePeer | back to summary |
|---|---|
| private NGNode doCreatePeer() | |
| doUpdatePeer | back to summary |
|---|---|
| private void doUpdatePeer() | |
| getArcHeight | back to summary |
|---|---|
| public final double getArcHeight() | |
| getArcWidth | back to summary |
|---|---|
| public final double getArcWidth() | |
| getClassCssMetaData | back to summary |
|---|---|
| public static List Hides javafx. Gets the
| |
| getCssMetaData | back to summary |
|---|---|
| public List Overrides javafx. Implements javafx. Doc from javafx. This method should delegate to
| |
| getHeight | back to summary |
|---|---|
| public final double getHeight() | |
| getWidth | back to summary |
|---|---|
| public final double getWidth() | |
| getX | back to summary |
|---|---|
| public final double getX() | |
| getY | back to summary |
|---|---|
| public final double getY() | |
| heightProperty | back to summary |
|---|---|
| public final DoubleProperty heightProperty() | |
| setArcHeight | back to summary |
|---|---|
| public final void setArcHeight(double value) | |
| setArcWidth | back to summary |
|---|---|
| public final void setArcWidth(double value) | |
| setHeight | back to summary |
|---|---|
| public final void setHeight(double value) | |
| setWidth | back to summary |
|---|---|
| public final void setWidth(double value) | |
| setX | back to summary |
|---|---|
| public final void setX(double value) | |
| setY | back to summary |
|---|---|
| public final void setY(double value) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides javafx. Returns a string representation of this | |
| widthProperty | back to summary |
|---|---|
| public final DoubleProperty widthProperty() | |
| xProperty | back to summary |
|---|---|
| public final DoubleProperty xProperty() | |
| yProperty | back to summary |
|---|---|
| public final DoubleProperty yProperty() | |
| Modifier and Type | Field and Description |
|---|---|
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final List |
| Access | Constructor and Description |
|---|---|
| private |
| ARC_HEIGHT | back to summary |
|---|---|
| private static final CssMetaData<Rectangle, Number> ARC_HEIGHT | |
| ARC_WIDTH | back to summary |
|---|---|
| private static final CssMetaData<Rectangle, Number> ARC_WIDTH | |
| STYLEABLES | back to summary |
|---|---|
| private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES | |
| StyleableProperties | back to summary |
|---|---|
| private StyleableProperties() | |