本文整理汇总了Java中javafx.scene.shape.Path.setEffect方法的典型用法代码示例。如果您正苦于以下问题:Java Path.setEffect方法的具体用法?Java Path.setEffect怎么用?Java Path.setEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Path
的用法示例。
在下文中一共展示了Path.setEffect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIconContent
import javafx.scene.shape.Path; //导入方法依赖的package包/类
public static Node createIconContent() {
Path path = new Path();
path.getElements().addAll(
new MoveTo(25, 25),
new HLineTo(45),
new ArcTo(20, 20, 0, 80, 25, true, true)
);
path.setStroke(Color.web("#b9c0c5"));
path.setStrokeWidth(5);
path.getStrokeDashArray().addAll(15d,15d);
path.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));
path.setEffect(effect);
return path;
}
示例2: initGraphics
import javafx.scene.shape.Path; //导入方法依赖的package包/类
private void initGraphics() {
// Set initial size
if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
} else {
gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
ring = new Path();
ring.setFillRule(FillRule.EVEN_ODD);
ring.setStroke(null);
ring.setFill(Gauge.DARK_COLOR);
ring.setEffect(new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), 1, 0, 0, 1));
sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
sectionsCtx = sectionsCanvas.getGraphicsContext2D();
mask = new Circle();
mask.setStroke(null);
mask.setFill(gauge.getBackgroundPaint());
knob = new Circle();
knob.setStroke(null);
knob.setFill(gauge.getKnobColor());
angleStep = ANGLE_RANGE / (gauge.getRange());
double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep;
needleRotate = new Rotate(180 - START_ANGLE);
needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle));
needle = new Path();
needle.setFillRule(FillRule.EVEN_ODD);
needle.setStroke(null);
needle.getTransforms().setAll(needleRotate);
valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit());
valueText.setMouseTransparent(true);
valueText.setTextOrigin(VPos.CENTER);
valueText.setFill(gauge.getValueColor());
Helper.enableNode(valueText, gauge.isValueVisible());
titleText = new Text(gauge.getTitle());
titleText.setTextOrigin(VPos.CENTER);
titleText.setFill(gauge.getTitleColor());
Helper.enableNode(titleText, !gauge.getTitle().isEmpty());
// Add all nodes
pane = new Pane(ring, sectionsCanvas, mask, knob, needle, valueText, titleText);
getChildren().setAll(pane);
}