JavaFX 形状属性

2024年8月29日 | 1 分钟阅读

所有 JavaFX 2D 形状类都具有由 JavaFX.scene.shape.Shape 类定义的通用属性。 在下表中,我们描述了通用的形状属性。

属性描述设置器方法
fill用于用定义的颜色填充形状。这是一个 <paint> 类型的属性。setFill(Paint)
平滑这是一个布尔类型的属性。 如果传递 true,则形状的边缘将变得平滑。setSmooth(boolean)
strokeDashOffset它定义了坐标系中显示形状虚线图案的距离。 这是一个双精度类型的属性。setStrokeDashOffset(Double)
strokeLineCap它表示线条端点的样式。 这是一个 strokeLineCap 类型的属性。setStrokeLineCap(StrokeLineCap)
strokeLineJoin它表示两个路径连接点的样式。setStrokeLineJoin(StrokeLineJoin)
strokeMiterLimit它应用于连接点内点和外点之间距离的限制。 这是一个双精度类型的属性。setStrokeMiterLimit(Double)
stroke它是一个颜色类型的属性,表示形状边界线的颜色。setStroke(paint)
strokeType它表示笔触的类型(边界线将施加到形状的位置),无论是内部、外部还是居中。setStrokeType(StrokeType)
strokeWidth它表示笔触的宽度。setStrokeWidth(Double)

示例


JavaFX Shape Properties Fill Example
JavaFX Shape Properties stroke Example
JavaFX Shape Properties strokeWidth Example
JavaFX Shape Properties Inside Stroke Outside Stroke Example
JavaFX Shape Properties Centered stroke Example
JavaFX Shape Properties setSmooth Example
JavaFX Shape Properties Stroke LineJoin Bevel or miter
JavaFX Shape Properties Stroke LineJoin Round
下一个主题JavaFX 线条