我需要绘制一条开放的弧线。
但是,当我输入这些值时,例如:
Arc arc = new Arc();
arc.setCenterX(100.0f);
arc.setCenterY(100.0f);
arc.setRadiusX(80.0f);
arc.setRadiusY(80.0f);
arc.setStartAngle(0.0f);
arc.setLength(80.0f);
arc.setType(ArcType.OPEN);
这样就会显示:
他为什么不直接画一个弧线呢?那么如何绘制呢?
请帮忙。
谢谢
最佳答案
默认填充为Color.BLACK
。
您应该将其设置为Color.TRANSPARENT
添加setStroke
和setStrokeWidth
以使圆弧可见。
像这样:
arc.setStroke(Color.BLACK);
arc.setStrokeWidth(2);
arc.setFill(Color.TRANSPARENT);
setFill
public final void setFill(Paint value)
Sets the value of the property fill.
Property description: Defines parameters to fill the interior of an Shape using the settings of the Paint context. The default value is Color.BLACK for all shapes except Line, Polyline, and Path. The default value is null for those shapes.
关于javafx - 如何在javafx中画一条开放的圆弧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54502045/