下面列出了javafx.scene.shape.Polyline#setStrokeWidth ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static Node createIconContent() {
Polyline polyline = new Polyline(new double[]{
45, 10,
10, 80,
80, 80,
});
polyline.setStroke(Color.web("#b9c0c5"));
polyline.setStrokeWidth(5);
polyline.getStrokeDashArray().addAll(15d,15d);
polyline.setFill(null);
javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
effect.setOffsetX(1);
effect.setOffsetY(1);
effect.setRadius(3);
effect.setColor(Color.rgb(0,0,0,0.6));
polyline.setEffect(effect);
return polyline;
}
public static Node createIconContent() {
Polyline polyline = new Polyline(new double[]{
45, 10,
10, 80,
80, 80,
});
polyline.setStroke(Color.web("#b9c0c5"));
polyline.setStrokeWidth(5);
polyline.getStrokeDashArray().addAll(15d,15d);
polyline.setFill(null);
javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
effect.setOffsetX(1);
effect.setOffsetY(1);
effect.setRadius(3);
effect.setColor(Color.rgb(0,0,0,0.6));
polyline.setEffect(effect);
return polyline;
}
public PolylineSample() {
super(180,90);
// Red stroked not closed triangle
Polyline polyline1 = new Polyline(new double[]{
45, 10,
10, 80,
80, 80,
});
polyline1.setFill(Color.TRANSPARENT);
polyline1.setStroke(Color.RED);
// Blue stroked closed triangle
Polyline polyline2 = new Polyline(new double[]{
135, 10,
100, 80,
170, 80,
135, 10,
});
polyline2.setStroke(Color.DODGERBLUE);
polyline2.setStrokeWidth(2);
polyline2.setFill(null);
// Create a group to show all the polylines);
getChildren().add(new Group(polyline1, polyline2));
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Polyline 1 Fill", polyline1.fillProperty()),
new SimplePropertySheet.PropDesc("Polyline 1 Stroke", polyline1.strokeProperty()),
new SimplePropertySheet.PropDesc("Polyline 2 Stroke", polyline2.strokeProperty())
);
// END REMOVE ME
}
public PolylineSample() {
super(180,90);
// Red stroked not closed triangle
Polyline polyline1 = new Polyline(new double[]{
45, 10,
10, 80,
80, 80,
});
polyline1.setFill(Color.TRANSPARENT);
polyline1.setStroke(Color.RED);
// Blue stroked closed triangle
Polyline polyline2 = new Polyline(new double[]{
135, 10,
100, 80,
170, 80,
135, 10,
});
polyline2.setStroke(Color.DODGERBLUE);
polyline2.setStrokeWidth(2);
polyline2.setFill(null);
// Create a group to show all the polylines);
getChildren().add(new Group(polyline1, polyline2));
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Polyline 1 Fill", polyline1.fillProperty()),
new SimplePropertySheet.PropDesc("Polyline 1 Stroke", polyline1.strokeProperty()),
new SimplePropertySheet.PropDesc("Polyline 2 Stroke", polyline2.strokeProperty())
);
// END REMOVE ME
}