如何在 javafx 中绘制开放弧?
How to draw an open arc in javafx?
我需要画一个开放的圆弧。
但是,当我输入这些值时,例如:
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.
我需要画一个开放的圆弧。
但是,当我输入这些值时,例如:
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.