Class Path

  • All Implemented Interfaces:
    Styleable, EventTarget


    public class Path
    extends Shape
    The Path class represents a simple shape and provides facilities required for basic construction and management of a geometric path. Example:
    import javafx.scene.shape.*;
    
    Path path = new Path();
    
    MoveTo moveTo = new MoveTo();
    moveTo.setX(0.0f);
    moveTo.setY(0.0f);
    
    HLineTo hLineTo = new HLineTo();
    hLineTo.setX(70.0f);
    
    QuadCurveTo quadCurveTo = new QuadCurveTo();
    quadCurveTo.setX(120.0f);
    quadCurveTo.setY(60.0f);
    quadCurveTo.setControlX(100.0f);
    quadCurveTo.setControlY(0.0f);
    
    LineTo lineTo = new LineTo();
    lineTo.setX(175.0f);
    lineTo.setY(55.0f);
    
    ArcTo arcTo = new ArcTo();
    arcTo.setX(50.0f);
    arcTo.setY(50.0f);
    arcTo.setRadiusX(50.0f);
    arcTo.setRadiusY(50.0f);
    
    path.getElements().add(moveTo);
    path.getElements().add(hLineTo);
    path.getElements().add(quadCurveTo);
    path.getElements().add(lineTo);
    path.getElements().add(arcTo);
    
    
    Since:
    JavaFX 2.0
    • Property Detail

      • fillRule

        public final ObjectProperty<FillRule> fillRuleProperty
        Defines the filling rule constant for determining the interior of the path. The value must be one of the following constants: FillRile.EVEN_ODD or FillRule.NON_ZERO. The default value is FillRule.NON_ZERO.
        Default value:
        FillRule.NON_ZERO
        See Also:
        getFillRule(), setFillRule(FillRule)
    • Constructor Detail

      • Path

        public Path​()
        Creates an empty instance of Path.
      • Path

        public Path​(PathElement... elements)
        Creates a new instance of Path
        Parameters:
        elements - Elements of the Path
        Since:
        JavaFX 2.1
      • Path

        public Path​(Collection<? extends PathElement> elements)
        Creates new instance of Path
        Parameters:
        elements - The collection of the elements of the Path
        Since:
        JavaFX 2.2
    • Method Detail

      • setFillRule

        public final void setFillRule​(FillRule value)
        Sets the value of the property fillRule.
        Property description:
        Defines the filling rule constant for determining the interior of the path. The value must be one of the following constants: FillRile.EVEN_ODD or FillRule.NON_ZERO. The default value is FillRule.NON_ZERO.
        Default value:
        FillRule.NON_ZERO
      • getFillRule

        public final FillRule getFillRule​()
        Gets the value of the property fillRule.
        Property description:
        Defines the filling rule constant for determining the interior of the path. The value must be one of the following constants: FillRile.EVEN_ODD or FillRule.NON_ZERO. The default value is FillRule.NON_ZERO.
        Default value:
        FillRule.NON_ZERO
      • fillRuleProperty

        public final ObjectProperty<FillRule> fillRuleProperty​()
        Defines the filling rule constant for determining the interior of the path. The value must be one of the following constants: FillRile.EVEN_ODD or FillRule.NON_ZERO. The default value is FillRule.NON_ZERO.
        Default value:
        FillRule.NON_ZERO
        See Also:
        getFillRule(), setFillRule(FillRule)
      • getElements

        public final ObservableList<PathElement> getElements​()
        Gets observable list of path elements of this path.
        Returns:
        Elements of this path
      • toString

        public String toString​()
        Returns a string representation of this Path object.
        Overrides:
        toString in class Node
        Returns:
        a string representation of this Path object.