Eeliya
Eeliya

Reputation: 1574

How to create complex shape in JavaFX

I remember in java 2D i could create area from my shape and add other shapes to it or subtract.

is it possible to do the same in javafx?

Upvotes: 3

Views: 1731

Answers (1)

Michael Berry
Michael Berry

Reputation: 72274

You may be after the Polygon class which lets you define complex polygons by passing an array of points into the constructor. As for "adding other shapes to it or subtracting", I presume you mean intersecting / subtracting with other shapes - in which case have a look at Shape.subtract(), Shape.intersect(), and Shape.union(). All are static methods on the Shape class which take two shapes as a parameter and return the result.

Upvotes: 4

Related Questions