JavaFX modify polygons


Is there a way to modify a polygon in JavaFX? For example if I have a triangle and I press and then drag a point from that triangle, the triangle will modify with the new coordinates of the point.

8/5/2016 9:32:36 PM

Accepted Answer

  1. Layer some control nodes over the corners of the polygon.
  2. Attach appropriate event handlers to the control nodes so that they can be dragged around.
  3. Modify the polygon's points as the control node is moved (using change listeners attached to each of the control node's location properties).

Here is a sample solution.


I derived this solution from: CubicCurve JavaFX

5/23/2017 12:14:54 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow