Java Swing: Drawing curved lines

前端 未结 2 2033
不思量自难忘°
不思量自难忘° 2021-01-12 19:30

I\'m trying to draw curved lines in Java. A simple bezier curve with an (X,Y) start, an (X,Y) end, and a curve amount would suffice.

I can\'t find a way to do this i

2条回答
  •  春和景丽
    2021-01-12 20:19

    You can draw a Bézier curve using the Java 2D Object Path2D.Double. Just call the method curveTo(float x1, float y1, float x2, float y2, float x3, float y3) and define the 3 coordinate.

    • first Bézier control point
    • second Bézier control point
    • final end point

提交回复
热议问题