本文整理汇总了Java中javafx.scene.shape.Arc.setStrokeType方法的典型用法代码示例。如果您正苦于以下问题:Java Arc.setStrokeType方法的具体用法?Java Arc.setStrokeType怎么用?Java Arc.setStrokeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Arc
的用法示例。
在下文中一共展示了Arc.setStrokeType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGraphics
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
@Override protected void initGraphics() {
// Set initial size
if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
} else {
clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
ZonedDateTime time = clock.getTime();
secondBackgroundCircle = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48);
secondBackgroundCircle.setStrokeWidth(PREFERRED_WIDTH * 0.008);
secondBackgroundCircle.setStrokeType(StrokeType.CENTERED);
secondBackgroundCircle.setStrokeLineCap(StrokeLineCap.ROUND);
secondBackgroundCircle.setFill(null);
secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
secondBackgroundCircle.setVisible(clock.isSecondsVisible());
secondBackgroundCircle.setManaged(clock.isSecondsVisible());
dateText = new Text(dateTextFormatter.format(time));
dateText.setVisible(clock.isDayVisible());
dateText.setManaged(clock.isDayVisible());
dateNumbers = new Text(dateNumberFormatter.format(time));
dateNumbers.setVisible(clock.isDateVisible());
dateNumbers.setManaged(clock.isDateVisible());
hour = new Text(HOUR_FORMATTER.format(time));
hour.setFill(clock.getHourColor());
minute = new Text(MINUTE_FORMATTER.format(time));
minute.setFill(clock.getMinuteColor());
secondArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, (-6 * clock.getTime().getSecond()));
secondArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
secondArc.setStrokeType(StrokeType.CENTERED);
secondArc.setStrokeLineCap(StrokeLineCap.ROUND);
secondArc.setFill(null);
secondArc.setStroke(clock.getSecondColor());
secondArc.setVisible(clock.isSecondsVisible());
secondArc.setManaged(clock.isSecondsVisible());
pane = new Pane(secondBackgroundCircle, dateText, dateNumbers, hour, minute, secondArc);
pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth()))));
pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
getChildren().setAll(pane);
}
示例2: initGraphics
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
@Override protected void initGraphics() {
// Set initial size
if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
} else {
clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
ZonedDateTime time = clock.getTime();
secondBackgroundCircle = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48);
secondBackgroundCircle.setStrokeWidth(PREFERRED_WIDTH * 0.008);
secondBackgroundCircle.setStrokeType(StrokeType.CENTERED);
secondBackgroundCircle.setStrokeLineCap(StrokeLineCap.ROUND);
secondBackgroundCircle.setFill(null);
secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
secondBackgroundCircle.setVisible(clock.isSecondsVisible());
secondBackgroundCircle.setManaged(clock.isSecondsVisible());
dateText = new Text(DATE_TEXT_FORMATTER.format(time));
dateText.setVisible(clock.isDateVisible());
dateText.setManaged(clock.isDateVisible());
hour = new Text(HOUR_FORMATTER.format(time));
hour.setFill(clock.getHourColor());
minute = new Text(MINUTE_FORMATTER.format(time));
minute.setFill(clock.getMinuteColor());
minuteCircle = new Circle(0.075 * PREFERRED_WIDTH);
secondArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, (-6 * clock.getTime().getSecond()));
secondArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
secondArc.setStrokeType(StrokeType.CENTERED);
secondArc.setStrokeLineCap(StrokeLineCap.BUTT);
secondArc.setFill(null);
secondArc.setStroke(clock.getSecondColor());
secondArc.setVisible(clock.isSecondsVisible());
secondArc.setManaged(clock.isSecondsVisible());
pane = new Pane(secondBackgroundCircle, dateText, hour, secondArc, minuteCircle, minute);
pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), new Insets(PREFERRED_WIDTH * 0.04))));
getChildren().setAll(pane);
}
示例3: initGraphics
import javafx.scene.shape.Arc; //导入方法依赖的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);
}
}
Color barColor = gauge.getBarColor();
gauge.setGradientBarStops(new Stop(0.0, barColor),
new Stop(0.01, barColor),
new Stop(0.75, barColor.deriveColor(-10, 1, 1, 1)),
new Stop(1.0, barColor.deriveColor(-20, 1, 1, 1)));
shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.45), 0.01 * PREFERRED_WIDTH, 0, 0.01 * PREFERRED_WIDTH, 0);
circle = new Circle();
circle.setFill(null);
arc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, 0);
arc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
arc.setStrokeType(StrokeType.CENTERED);
arc.setStrokeLineCap(StrokeLineCap.ROUND);
arc.setFill(null);
fakeDot = new Circle();
fakeDot.setStroke(null);
dot = new Circle();
dot.setStroke(null);
dot.setVisible(false);
dot.setEffect(shadow);
titleText = new Text(gauge.getTitle());
titleText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.5));
titleText.setFill(gauge.getTitleColor());
Helper.enableNode(titleText, !gauge.getTitle().isEmpty());
valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
valueText.setFont(Fonts.robotoRegular(PREFERRED_WIDTH * 0.27333));
valueText.setFill(gauge.getValueColor());
Helper.enableNode(valueText, gauge.isValueVisible());
unitText = new Text(gauge.getUnit());
unitText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.08));
unitText.setFill(gauge.getUnitColor());
Helper.enableNode(unitText, !gauge.getUnit().isEmpty());
pane = new Pane(circle, arc, fakeDot, dot, titleText, valueText, unitText);
getChildren().setAll(pane);
}
示例4: initGraphics
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
private void initGraphics(final double MAX_OUTER_VALUE, final double MAX_MIDDLE_VALUE, final double MAX_INNER_VALUE) {
shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.45), 0.01 * PREFERRED_WIDTH, 0, 0.01 * PREFERRED_WIDTH, 0);
textShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 1, 1, 0, 0);
outerGauge = createGauge(MAX_OUTER_VALUE, DEFAULT_OUTER_COLOR);
middleGauge = createGauge(MAX_MIDDLE_VALUE, DEFAULT_MIDDLE_COLOR);
innerGauge = createGauge(MAX_INNER_VALUE, DEFAULT_INNER_COLOR);
outerCircle = new Circle();
outerCircle.setFill(null);
middleCircle = new Circle();
middleCircle.setFill(null);
innerCircle = new Circle();
innerCircle.setFill(null);
outerArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, 0);
outerArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
outerArc.setStrokeType(StrokeType.CENTERED);
outerArc.setStrokeLineCap(StrokeLineCap.ROUND);
outerArc.setFill(null);
middleArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, 0);
middleArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
middleArc.setStrokeType(StrokeType.CENTERED);
middleArc.setStrokeLineCap(StrokeLineCap.ROUND);
middleArc.setFill(null);
innerArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, 0);
innerArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
innerArc.setStrokeType(StrokeType.CENTERED);
innerArc.setStrokeLineCap(StrokeLineCap.ROUND);
innerArc.setFill(null);
fakeOuterDot = new Circle();
fakeOuterDot.setStroke(null);
fakeMiddleDot = new Circle();
fakeMiddleDot.setStroke(null);
fakeInnerDot = new Circle();
fakeInnerDot.setStroke(null);
outerDot = new Circle();
outerDot.setStroke(null);
outerDot.setVisible(false);
outerDot.setEffect(shadow);
middleDot = new Circle();
middleDot.setStroke(null);
middleDot.setVisible(false);
middleDot.setEffect(shadow);
innerDot = new Circle();
innerDot.setStroke(null);
innerDot.setVisible(false);
innerDot.setEffect(shadow);
outerText = new Text("");
outerText.setTextOrigin(VPos.CENTER);
outerText.setEffect(textShadow);
middleText = new Text("");
middleText.setTextOrigin(VPos.CENTER);
middleText.setEffect(textShadow);
innerText = new Text("");
innerText.setTextOrigin(VPos.CENTER);
innerText.setEffect(textShadow);
pane = new Pane(outerCircle, middleCircle, innerCircle,
outerArc, middleArc, innerArc,
fakeOuterDot, fakeMiddleDot, fakeInnerDot,
outerDot, middleDot, innerDot,
outerText, middleText, innerText);
getChildren().setAll(pane);
}