JavaFX modify polygons

淺唱寂寞╮ 提交于 2019-12-01 06:00:29

问题


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.


回答1:


  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



来源:https://stackoverflow.com/questions/15981274/javafx-modify-polygons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!