Raggie
Raggie

Reputation: 23

How to draw a line with multiple points in javaFx?

I want to create a class that extends Line or Path or something(not sure)

The class is used to create a line between two points, The Source and the Target.

When the user clicks on the line, a point should be added. This point (Nail) can then be dragged around and the line moves accordingly.

Currently the Source and Target are objects of a class that extends Circle and Nail is a separate class that extends circle.

These objects are added to the pane and drawn.

eg. Points A and B : A->B After adding Nail: A->N->B

The Line class should hold an arraylist of nail objects. I just need to know what the Line class should extend. I am not sure as it needs to update itself.

Upvotes: 1

Views: 1346

Answers (1)

Raggie
Raggie

Reputation: 23

THe behaviour can be achieved using PolyLine. To reference different points on the line use getAllPoints().set/add/..

Upvotes: 1

Related Questions