Paths

Path is a metashape. You can merge any combination of shape-like PathElement objects into one Path and use the result as a single shape.

The following PathElement classes are supported in JavaFX 9:

ArcTo, ClosePath, CubicCurveTo, HLineTo, LineTo, MoveTo, QuadCurveTo, VLineTo

Their parameters mostly resemble corresponding shapes, except ClosePath, which is a marker of the path end.

Here is an example:

Take a look at the following code snippet:

// chapter2/shapes/PathDemo.javaArcTo arcTo = new ArcTo(); arcTo.setRadiusX(250);arcTo.setRadiusY(90);arcTo.setX(50);arcTo.setY(100);arcTo.setSweepFlag(true);Path path = new Path( new MoveTo(0, ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.