javafx - 如何在javafx中画一条开放的圆弧?

标签 javafx automatic-ref-counting

我需要绘制一条开放的弧线。

但是,当我输入这些值时,例如:

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);

这样就会显示:

enter image description here

他为什么不直接画一个弧线呢?那么如何绘制呢?

请帮忙。

谢谢

最佳答案

默认填充为Color.BLACK

您应该将其设置为Color.TRANSPARENT

添加setStrokesetStrokeWidth以使圆弧可见。

像这样:

arc.setStroke(Color.BLACK);
arc.setStrokeWidth(2);
arc.setFill(Color.TRANSPARENT);

Look here:

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/

相关文章:

ios - SDWebImage 苹果 LLVM 6.0 错误

带有空文本的 JavaFX TextFormatter 问题

java - 将全局按键监听器附加到多个按钮

java - 选项卡之间的间距

JavaFX:设置 ProgressIndicator 文本标签的颜色

java - 在 JavaFX TextArea 中突出显示字符串

Objective-C ARC 和 longjmp

ios tableview 图像不释放内存

ios - Xcode ARC 项目添加了带有发布调用的 dealloc

ios - ARC Objective-C 中的输出参数