如何在javafx中绘制开放弧? [英] How to draw an open arc in javafx?

查看:81
本文介绍了如何在javafx中绘制开放弧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要画一个开放的弧线.

I need to draw an open arc.

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

However, when I enter these values, for example:

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

因此它将显示:

他为什么不画圆弧?那我怎么画呢?

Why did not he just draw an arc? So how do I draw it?

请帮助.

谢谢

推荐答案

默认填充为 Color.BLACK .

您应该将其设置为 Color.TRANSPARENT

添加 setStroke setStrokeWidth 以使弧可见.

像这样:

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

setFill

公共最终无效setFill(绘画值)

设置属性填充的值.

属性描述:定义参数以使用Paint上下文的设置填充Shape的内部.除线",折线"和路径"以外的所有形状的默认值为Color.BLACK.这些形状的默认值为null.

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中绘制开放弧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆