Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Shape

[32:7] extends: Node

Wraps JavaFX javafx.scene.shape.Shape, the abstract base class for every 2D geometric primitive (Circle, Rectangle, Line, Polygon, ...). Shape extends Node and adds fill paint, stroke paint, stroke width, stroke type (inside/outside/centered), line join, line cap, miter limit, dash array, dash offset, and a smooth (anti-alias) flag. All shape wrappers in fx/ inherit from this class.

CSS Properties -- Shape

Property Values Default Description
-fx-fill <paint> black Fill paint for the interior of the shape.
-fx-smooth true | false true When true, anti-aliasing is applied to the shape edges.
-fx-stroke <paint> null Paint for the shape outline stroke. No stroke is drawn when null.
-fx-stroke-type inside | outside | centered centered Position of the stroke relative to the shape boundary.
-fx-stroke-dash-array <size> [<size>]* (none) Pattern of dashes and gaps for a dashed stroke.
-fx-stroke-dash-offset <number> 0 Offset into the dash pattern at which to begin rendering.
-fx-stroke-line-cap square | butt | round square Style of the end caps on open path strokes.
-fx-stroke-line-join miter | bevel | round miter Style used at corners where two stroke segments meet.
-fx-stroke-miter-limit <number> 10 Limit on the ratio of miter length to stroke width; beyond this the join becomes a bevel.
-fx-stroke-width <size> 1 Width of the shape stroke in pixels.

Methods

  • Shape ()

    Empty default constructor; populated by adopt. Shape is abstract in JavaFX.

  • adopt (object Ajo)

    Wraps an existing javafx.scene.shape.Shape AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a javafx.scene.shape.Shape.
    • @r A new Shape wrapper.
  • intersect (object Other)

    Returns a new shape that is the intersection (overlapping area) of this shape and another. This wraps the static JavaFX method Shape.intersect(Shape, Shape).

    • @p Other is the other shape, either a wrapper or a raw AJO.
    • @r A new Shape wrapper for the intersection.
  • subtract (object Other)

    Returns a new shape that is this shape with the area of another shape removed. This wraps the static JavaFX method Shape.subtract(Shape, Shape).

    • @p Other is the shape to subtract, either a wrapper or a raw AJO.
    • @r A new Shape wrapper for the difference.
  • union (object Other)

    Returns a new shape that is the union (combined area) of this shape and another. This wraps the static JavaFX method Shape.union(Shape, Shape).

    • @p Other is the other shape, either a wrapper or a raw AJO.
    • @r A new Shape wrapper for the union.
  • setStrokeType (StrokeType)

    Sets the position of the stroke relative to the shape boundary.

    • @p StrokeType is an fxstroketype value or name string (INSIDE, OUTSIDE, CENTERED), or a wrapper/AJO.
    • @r this object
  • getStrokeType ()

    Returns the current stroke type.

    • @r A StrokeType AussomJavaObject.
  • strokeTypeProperty ()

    Returns the strokeType property for this shape.

    • @r An ObjectProperty AussomJavaObject.
  • setStrokeWidth (double Width)

    Sets the width of the shape outline stroke in pixels.

    • @p Width is a double with the stroke width.
    • @r this object
  • getStrokeWidth ()

    Returns the current stroke width in pixels.

    • @r A double with the stroke width.
  • strokeWidthProperty ()

    Returns the strokeWidth property for this shape.

    • @r A DoubleProperty AussomJavaObject.
  • setStrokeLineJoin (LineJoin)

    Sets the style used at corners where two stroke segments meet.

    • @p LineJoin is an fxlinejoin value or name string (MITER, BEVEL, ROUND), or a wrapper/AJO.
    • @r this object
  • getStrokeLineJoin ()

    Returns the current stroke line join style.

    • @r A StrokeLineJoin AussomJavaObject.
  • strokeLineJoinProperty ()

    Returns the strokeLineJoin property for this shape.

    • @r An ObjectProperty AussomJavaObject.
  • setStrokeLineCap (LineCap)

    Sets the style of the end caps on open path strokes.

    • @p LineCap is an fxlinecap value or name string (SQUARE, BUTT, ROUND), or a wrapper/AJO.
    • @r this object
  • getStrokeLineCap ()

    Returns the current stroke line cap style.

    • @r A StrokeLineCap AussomJavaObject.
  • strokeLineCapProperty ()

    Returns the strokeLineCap property for this shape.

    • @r An ObjectProperty AussomJavaObject.
  • setStrokeMiterLimit (double Limit)

    Sets the miter limit, the ratio of miter length to stroke width above which a miter join is converted to a bevel.

    • @p Limit is a double with the miter limit; values below 1.0 are clamped.
    • @r this object
  • getStrokeMiterLimit ()

    Returns the current miter limit.

    • @r A double with the miter limit.
  • strokeMiterLimitProperty ()

    Returns the strokeMiterLimit property for this shape.

    • @r A DoubleProperty AussomJavaObject.
  • setStrokeDashOffset (double Offset)

    Sets the offset into the dash pattern at which to begin rendering.

    • @p Offset is a double with the dash offset in user-space units.
    • @r this object
  • getStrokeDashOffset ()

    Returns the current dash offset.

    • @r A double with the dash offset.
  • strokeDashOffsetProperty ()

    Returns the strokeDashOffset property for this shape.

    • @r A DoubleProperty AussomJavaObject.
  • getStrokeDashArray ()

    Returns the observable list of dash segment lengths. Mutate the list to change the dash pattern.

    • @r An ObservableList AussomJavaObject of Double values.
  • setFill (object Paint)

    Sets the fill paint for the interior of the shape.

    • @p Paint is a Paint AussomJavaObject (Color, LinearGradient, RadialGradient, ImagePattern).
    • @r this object
  • getFill ()

    Returns the current fill paint.

    • @r A Paint AussomJavaObject, or null when there is no fill.
  • fillProperty ()

    Returns the fill property for this shape.

    • @r An ObjectProperty AussomJavaObject.
  • setStroke (object Paint)

    Sets the stroke paint used to draw the shape outline.

    • @p Paint is a Paint AussomJavaObject, or null to disable the stroke.
    • @r this object
  • getStroke ()

    Returns the current stroke paint.

    • @r A Paint AussomJavaObject, or null when there is no stroke.
  • strokeProperty ()

    Returns the stroke property for this shape.

    • @r An ObjectProperty AussomJavaObject.
  • setSmooth (bool Smooth)

    Sets whether anti-aliasing is applied to the shape edges.

    • @p Smooth is a bool; when true edges are anti-aliased.
    • @r this object
  • isSmooth ()

    Returns whether smoothing (anti-aliasing) is enabled.

    • @r A bool with the current smooth setting.
  • smoothProperty ()

    Returns the smooth property for this shape.

    • @r A BooleanProperty AussomJavaObject.
  • getCssMetaData ()

    Returns the CSS metadata for this shape's styleable properties.

    • @r A List AussomJavaObject of CssMetaData entries.