javafx.scene.shape.Arc#setFill ( )源码实例Demo

下面列出了javafx.scene.shape.Arc#setFill ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Medusa   文件: IndicatorSkin.java
private void drawSections() {
    if (sections.isEmpty()) return;
    sectionLayer.getChildren().clear();

    double    centerX     = width * 0.5;
    double    centerY     = height * 0.85;
    double    barRadius   = height * 0.54210526;
    double    barWidth    = width * 0.28472222;
    List<Arc> sectionBars = new ArrayList<>(sections.size());
    for (Section section : sections) {
        Arc sectionBar = new Arc(centerX, centerY, barRadius, barRadius, angleRange * 0.5 + 90 - (section.getStart() * angleStep), -((section.getStop() - section.getStart()) - minValue) * angleStep);
        sectionBar.setType(ArcType.OPEN);
        sectionBar.setStroke(section.getColor());
        sectionBar.setStrokeWidth(barWidth);
        sectionBar.setStrokeLineCap(StrokeLineCap.BUTT);
        sectionBar.setFill(null);
        Tooltip sectionTooltip = new Tooltip(new StringBuilder(section.getText()).append("\n").append(String.format(Locale.US, "%.2f", section.getStart())).append(" - ").append(String.format(Locale.US, "%.2f", section.getStop())).toString());
        sectionTooltip.setTextAlignment(TextAlignment.CENTER);
        Tooltip.install(sectionBar, sectionTooltip);
        sectionBars.add(sectionBar);
    }
    sectionLayer.getChildren().addAll(sectionBars);
}
 
源代码2 项目: marathonv5   文件: ArcSample.java
public static Node createIconContent() {
    Arc arc = new Arc(57,57,45,45,40,100);
    arc.setStroke(Color.web("#b9c0c5"));
    arc.setStrokeWidth(5);
    arc.getStrokeDashArray().addAll(15d,15d);
    arc.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));
    arc.setEffect(effect);
    return arc;
}
 
/** Return a Arc of specified properties */
private Arc getArc(Circle c) {
	Arc a = new Arc(c.getRadius(), c.getRadius() * 1.30, 
		c.getRadius() / 2, c.getRadius() / 4, 0, -180);
	a.setType(ArcType.OPEN);
	a.setFill(Color.WHITE);
	a.setStroke(Color.BLACK);
	return a;
}
 
源代码4 项目: marathonv5   文件: ArcSample.java
public static Node createIconContent() {
    Arc arc = new Arc(57,57,45,45,40,100);
    arc.setStroke(Color.web("#b9c0c5"));
    arc.setStrokeWidth(5);
    arc.getStrokeDashArray().addAll(15d,15d);
    arc.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));
    arc.setEffect(effect);
    return arc;
}
 
源代码5 项目: latexdraw   文件: RotationHandler.java
/**
 * The constructor by default.
 * @param border The selection border.
 */
public RotationHandler(final @NotNull Rectangle border) {
	super();
	final Arc arc = new Arc();
	arc.setCenterX(DEFAULT_SIZE / 2d);
	arc.setRadiusX(DEFAULT_SIZE / 2d);
	arc.setRadiusY(DEFAULT_SIZE / 2d);
	arc.setType(ArcType.OPEN);
	arc.setLength(270d);
	arc.setStroke(DEFAULT_COLOR);
	arc.setStrokeWidth(2.5d);
	arc.setStrokeLineCap(StrokeLineCap.BUTT);
	arc.setFill(new Color(1d, 1d, 1d, 0d));
	getChildren().add(arc);

	final Path arrows = new Path();
	arrows.setStroke(null);
	arrows.setFill(new Color(0d, 0d, 0d, 0.4));
	arrows.getElements().add(new MoveTo(DEFAULT_SIZE + DEFAULT_SIZE / 4d, 0d));
	arrows.getElements().add(new LineTo(DEFAULT_SIZE, DEFAULT_SIZE / 2d));
	arrows.getElements().add(new LineTo(DEFAULT_SIZE - DEFAULT_SIZE / 4d, 0d));
	arrows.getElements().add(new ClosePath());
	getChildren().add(arrows);

	translateXProperty().bind(Bindings.createDoubleBinding(() -> border.getLayoutX() + border.getWidth(), border.xProperty(),
		border.widthProperty(), border.layoutXProperty()));
	translateYProperty().bind(Bindings.createDoubleBinding(() -> border.getLayoutY() + DEFAULT_SIZE, border.yProperty(),
		border.heightProperty(), border.layoutYProperty()));
}
 
源代码6 项目: Intro-to-Java-Programming   文件: FanPane.java
/** Add four arcs to a pane and place them in a stack pane */
private Pane getBlades() {
	Pane pane = new Pane();
	double angle = 0;
	for (int i = 0; i < 4; i++) {
		Arc arc = new Arc(125, 115, 90, 90, angle + 90, 50);
		arc.setFill(Color.BLACK);
		arc.setType(ArcType.ROUND);
		pane.getChildren().add(arc);
		angle += 90;
	}
	return pane;
}
 
@Override // Override the start method in the Applicaton class
public void start(Stage primaryStage) {
	// Create a pane
	Pane pane = new Pane();

	// Create an ellipse and set its properties
	Ellipse ellipse = new Ellipse(75, 40, 50, 20);
	ellipse.setStroke(Color.BLACK);
	ellipse.setFill(Color.WHITE);

	// Create two Arcs and set their properties
	Arc arc1 = new Arc(ellipse.getCenterX(), 150, ellipse.getRadiusX(), 
		ellipse.getRadiusY(), 0, -180);
	arc1.setType(ArcType.OPEN);
	arc1.setFill(Color.WHITE);
	arc1.setStroke(Color.BLACK);

	Arc arc2 = new Arc(ellipse.getCenterX(), arc1.getCenterY(), 
		ellipse.getRadiusX(), ellipse.getRadiusY(), 0, 180);
	arc2.setType(ArcType.OPEN);
	arc2.setFill(Color.WHITE);
	arc2.setStroke(Color.BLACK);
	arc2.getStrokeDashArray().addAll(6.0, 21.0);

	// Create two lines and set thier properties
	Line line1 = new Line(ellipse.getCenterX() - ellipse.getRadiusX(), 
		ellipse.getCenterY(), ellipse.getCenterX() - ellipse.getRadiusX(),
		arc1.getCenterY());
	Line line2 = new Line((ellipse.getCenterX() - ellipse.getRadiusX()) + 
		ellipse.getRadiusX() * 2, ellipse.getCenterY(), 
		(ellipse.getCenterX() - ellipse.getRadiusX()) 
		+ ellipse.getRadiusX() * 2, arc1.getCenterY());

	// Place nodes in pane
	pane.getChildren().addAll(ellipse, arc1, arc2, line1, line2);

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane, 150, 200);
	primaryStage.setTitle("Exercise_14_10"); // Set the stage title
	primaryStage.setScene(scene); // Place the scenen in the stage
	primaryStage.show(); // Display the stage
}
 
源代码8 项目: Medusa   文件: MinimalClockSkin.java
@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.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);
}
 
源代码9 项目: tilesfx   文件: GaugeTileSkin.java
@Override protected void initGraphics() {
    super.initGraphics();

    if (tile.isAutoScale()) tile.calcAutoScale();
    oldValue          = tile.getValue();
    sectionMap        = new HashMap<>(sections.size());
    for(Section section : sections) { sectionMap.put(section, new Arc()); }

    barColor       = tile.getBarColor();
    thresholdColor = tile.getThresholdColor();

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(barColor);
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    thresholdBar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, -angleRange * 0.5 + 90, 0);
    thresholdBar.setType(ArcType.OPEN);
    thresholdBar.setStroke(tile.getThresholdColor());
    thresholdBar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    thresholdBar.setStrokeLineCap(StrokeLineCap.BUTT);
    thresholdBar.setFill(null);
    Helper.enableNode(thresholdBar, !tile.getSectionsVisible());

    sectionPane = new Pane();
    Helper.enableNode(sectionPane, tile.getSectionsVisible());

    if (sectionsVisible) { drawSections(); }

    alertIcon = new Path();
    alertIcon.setFillRule(FillRule.EVEN_ODD);
    alertIcon.setFill(Color.YELLOW);
    alertIcon.setStroke(null);
    Helper.enableNode(alertIcon, tile.isAlert());
    alertTooltip = new Tooltip(tile.getAlertMessage());
    Tooltip.install(alertIcon, alertTooltip);

    needleRotate     = new Rotate((tile.getValue() - oldValue - minValue) * angleStep);
    needleRectRotate = new Rotate((tile.getValue() - oldValue - minValue) * angleStep);

    needleRect = new Rectangle();
    needleRect.setFill(tile.getBackgroundColor());
    needleRect.getTransforms().setAll(needleRectRotate);

    needle = new Path();
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);
    needle.setFill(tile.getNeedleColor());
    needle.setStrokeWidth(0);
    needle.setStroke(Color.TRANSPARENT);

    titleText = new Text(tile.getTitle());
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());

    valueText = new Text(String.format(locale, formatString, tile.getCurrentValue()));
    valueText.setFill(tile.getValueColor());
    valueText.setTextOrigin(VPos.BASELINE);
    Helper.enableNode(valueText, tile.isValueVisible() && !tile.isAlert());

    upperUnitText = new Text("");
    upperUnitText.setFill(tile.getUnitColor());
    Helper.enableNode(upperUnitText, !tile.getUnit().isEmpty());

    fractionLine = new Line();

    unitText = new Text(tile.getUnit());
    unitText.setFill(tile.getUnitColor());
    Helper.enableNode(unitText, !tile.getUnit().isEmpty());

    unitFlow = new VBox(upperUnitText, unitText);
    unitFlow.setAlignment(Pos.CENTER_RIGHT);

    valueUnitFlow = new HBox(valueText, unitFlow);
    valueUnitFlow.setAlignment(Pos.CENTER);
    valueUnitFlow.setMouseTransparent(true);

    minValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMinValue()));
    minValueText.setFill(tile.getTitleColor());

    maxValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue()));
    maxValueText.setFill(tile.getTitleColor());

    thresholdRect = new Rectangle();
    thresholdRect.setFill(sectionsVisible ? Color.TRANSPARENT : tile.getValue() > tile.getThreshold() ? tile.getThresholdColor() : Tile.GRAY);
    Helper.enableNode(thresholdRect, tile.isThresholdVisible());

    thresholdText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getThreshold()));
    thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : Tile.GRAY);
    Helper.enableNode(thresholdText, tile.isThresholdVisible());

    getPane().getChildren().addAll(barBackground, thresholdBar, sectionPane, alertIcon, needleRect, needle, titleText, valueUnitFlow, fractionLine, minValueText, maxValueText, thresholdRect, thresholdText);
}
 
源代码10 项目: tilesfx   文件: TimerControlTileSkin.java
private void drawTimeSections() {
    if (sectionMap.isEmpty()) return;
    ZonedDateTime time              = tile.getTime();
    DayOfWeek     day               = time.getDayOfWeek();
    boolean       isAM              = time.get(ChronoField.AMPM_OF_DAY) == 0;
    double        offset            = 90;
    double        angleStep         = 360.0 / 60.0;
    boolean       highlightSections = tile.isHighlightSections();
    for (TimeSection section : sectionMap.keySet()) {
        LocalTime   start     = section.getStart();
        LocalTime   stop      = section.getStop();
        boolean     isStartAM = start.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     isStopAM  = stop.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     draw      = isAM ? (isStartAM || isStopAM) : (!isStartAM || !isStopAM);
        if (!section.getDays().contains(day)) { draw = false; }
        if (!section.isActive()) { draw = false; }
        if (draw) {
            double sectionStartAngle = (start.getHour() % 12 * 5.0 + start.getMinute() / 12.0 + start.getSecond() / 300.0) * angleStep + 180;
            double sectionAngleExtend = ((stop.getHour() - start.getHour()) % 12 * 5.0 + (stop.getMinute() - start.getMinute()) / 12.0 + (stop.getSecond() - start.getSecond()) / 300.0) * angleStep;
            if (start.getHour() > stop.getHour()) { sectionAngleExtend = (360.0 - Math.abs(sectionAngleExtend)); }

            Arc arc = sectionMap.get(section);
            arc.setCenterX(clockSize * 0.5);
            arc.setCenterY(clockSize * 0.5);
            arc.setRadiusX(clockSize * 0.45);
            arc.setRadiusY(clockSize * 0.45);
            arc.setStartAngle(-(offset + sectionStartAngle));
            arc.setLength(-sectionAngleExtend);
            arc.setType(ArcType.OPEN);
            arc.setStrokeWidth(clockSize * 0.04);
            arc.setStrokeLineCap(StrokeLineCap.BUTT);
            arc.setFill(null);

            if (highlightSections) {
                arc.setStroke(section.contains(time.toLocalTime()) ? section.getHighlightColor() : section.getColor());
            } else {
                arc.setStroke(section.getColor());
            }
        }
    }
}
 
源代码11 项目: Intro-to-Java-Programming   文件: Exercise_14_17.java
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Create a pane
	Pane pane = new Pane();

	// Create three polylines and set their properties
	Polyline polyline1 = new Polyline();
	pane.getChildren().add(polyline1);
	polyline1.setStroke(Color.BLACK);
	ObservableList<Double> list = polyline1.getPoints();
	double x1 = 40.0;
	double y1 = 190.0;
	double y2 = 20.0;
	double x3 = 125.0;
	list.addAll(x1, y1, x1, y2, x3, y2, x3, y1 * .60);

	Polyline polyline2 = new Polyline();
	pane.getChildren().add(polyline2);
	polyline2.setStroke(Color.BLACK);
	ObservableList<Double> list2 = polyline2.getPoints();
	list2.addAll((x1 + x3) * .5, y1 * .5, x3, y1 * .25,
		x3 + (x3 - x1) * .5, y1 * .5);

	Polyline polyline3 = new Polyline();
	pane.getChildren().add(polyline3);
	polyline3.setStroke(Color.BLACK);
	ObservableList<Double> list3 = polyline3.getPoints();
	list3.addAll((x1 + x3) * .6, y1 * .80, x3, y1 * .60,
		x3 + (x3 - x1) * .3, y1 * .80);

	// Create a circle and set its properties
	Circle circle = new Circle(x3, y1 * .25, 15);
	circle.setFill(Color.WHITE);
	circle.setStroke(Color.BLACK);
	pane.getChildren().add(circle);

	// Create an arc and set its properties
	Arc arc = new Arc(x1, y1 + 1, 25, 15, 0, 180);
	arc.setFill(Color.WHITE);
	arc.setStroke(Color.BLACK);
	pane.getChildren().add(arc);

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane, 200, 200);
	primaryStage.setTitle("Exercise_14_17"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
源代码12 项目: tilesfx   文件: CountdownTimerTileSkin.java
@Override protected void initGraphics() {
    super.initGraphics();

    duration  = tile.getTimePeriod();
    minValue  = 0;
    maxValue  = duration.getSeconds();
    range     = duration.getSeconds();
    angleStep = ANGLE_RANGE / range;
    locale    = tile.getLocale();

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    enableNode(titleText, !tile.getTitle().isEmpty());

    text = new Text(tile.getText());
    text.setFill(tile.getTextColor());
    enableNode(text, tile.isTextVisible());

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.468, PREFERRED_HEIGHT * 0.468, 90, 360);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(tile.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.468, PREFERRED_HEIGHT * 0.468, 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(tile.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);

    separator = new Line(PREFERRED_WIDTH * 0.5, 1, PREFERRED_WIDTH * 0.5, 0.16667 * PREFERRED_HEIGHT);
    separator.setStroke(tile.getBackgroundColor());
    separator.setFill(Color.TRANSPARENT);

    durationText = new Text();
    durationText.setFont(Fonts.latoRegular(PREFERRED_WIDTH * 0.27333));
    durationText.setFill(tile.getValueColor());
    durationText.setTextOrigin(VPos.CENTER);

    durationFlow = new TextFlow(durationText);
    durationFlow.setTextAlignment(TextAlignment.CENTER);

    timeText = new Text(DTF.format(LocalTime.now().plus(tile.getTimePeriod().getSeconds(), ChronoUnit.SECONDS)));
    timeText.setFont(Fonts.latoRegular(PREFERRED_WIDTH * 0.27333));
    timeText.setFill(tile.getValueColor());
    timeText.setTextOrigin(VPos.CENTER);
    enableNode(timeText, tile.isValueVisible());

    timeFlow = new TextFlow(timeText);
    timeFlow.setTextAlignment(TextAlignment.CENTER);

    runningListener = (o, ov, nv) -> {
        if (nv) {
            timeText.setText(DTF.format(LocalTime.now().plus(duration.getSeconds(), ChronoUnit.SECONDS)));
        }
    };
    timeListener = e -> {
        if (TimeEventType.SECOND == e.TYPE) {
            updateBar();
        }
    };

    getPane().getChildren().addAll(barBackground, bar, separator, titleText, text, durationFlow, timeFlow);
}
 
源代码13 项目: medusademo   文件: Slim1Skin.java
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);
        }
    }

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48590226, PREFERRED_HEIGHT * 0.48590226, 90, 360);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(gauge.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.ROUND);
    barBackground.setFill(null);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48590226, PREFERRED_HEIGHT * 0.48590226, 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(gauge.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    bar.setStrokeLineCap(StrokeLineCap.ROUND);
    bar.setFill(null);

    titleText = new Text(gauge.getTitle());
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFill(gauge.getValueColor());
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText = new Text(gauge.getUnit());
    unitText.setFill(gauge.getUnitColor());
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    pane = new Pane(barBackground, bar, titleText, valueText, unitText);
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
源代码14 项目: regulators   文件: ColorRegulator.java
private void initGraphics() {
    dropShadow  = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028);
    highlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    highlight.setInput(innerShadow);
    dropShadow.setInput(highlight);

    Stop[] stops = { new Stop(0.0, Color.rgb(255,255,0)),
                     new Stop(0.125, Color.rgb(255,0,0)),
                     new Stop(0.375, Color.rgb(255,0,255)),
                     new Stop(0.5, Color.rgb(0,0,255)),
                     new Stop(0.625, Color.rgb(0,255,255)),
                     new Stop(0.875, Color.rgb(0,255,0)),
                     new Stop(1.0, Color.rgb(255,255,0)) };

    List<Stop> reorderedStops = reorderStops(stops);

    gradientLookup = new GradientLookup(stops);

    barGradient = new ConicalGradient(reorderedStops);
    barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    barArc.setType(ArcType.OPEN);
    barArc.setStrokeLineCap(StrokeLineCap.ROUND);
    barArc.setFill(null);
    barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT)));

    buttonOn = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -125, 34.75);
    buttonOn.setFill(null);
    buttonOn.setStroke(color.get());
    buttonOn.setStrokeLineCap(StrokeLineCap.BUTT);
    buttonOn.setStrokeWidth(PREFERRED_WIDTH * 0.072);
    buttonOn.setEffect(dropShadow);

    buttonOff = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -89.75, 34.75);
    buttonOff.setFill(null);
    buttonOff.setStroke(color.get());
    buttonOff.setStrokeLineCap(StrokeLineCap.BUTT);
    buttonOff.setStrokeWidth(PREFERRED_WIDTH * 0.072);
    buttonOff.setEffect(dropShadow);

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42),
                          new Circle(center, center, PREFERRED_WIDTH * 0.3));
    ring.setFill(color.get());
    ring.setEffect(highlight);

    mainCircle = new Circle();
    mainCircle.setFill(color.get().darker().darker());

    textOn = new Text("ON");
    textOn.setFill(textColor.get());
    textOn.setTextOrigin(VPos.CENTER);
    textOn.setMouseTransparent(true);
    textOn.setRotate(17);

    textOff = new Text("OFF");
    textOff.setFill(textColor.get());
    textOff.setTextOrigin(VPos.CENTER);
    textOff.setMouseTransparent(true);
    textOff.setRotate(-17);

    indicatorRotate = new Rotate(-ANGLE_RANGE *  0.5, center, center);

    indicatorGlow        = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0);
    indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    indicatorHighlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    indicatorHighlight.setInput(indicatorInnerShadow);

    indicator = new Circle();
    indicator.setFill(color.get().darker());
    indicator.setStroke(color.get().darker().darker());
    indicator.setMouseTransparent(true);
    indicator.getTransforms().add(indicatorRotate);

    Group indicatorGroup = new Group(indicator);
    indicatorGroup.setEffect(indicatorHighlight);

    innerRing = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.24),
                               new Circle(center, center, PREFERRED_WIDTH * 0.2));
    innerRing.setFill(color.get());

    currentColorCircle = new Circle();
    currentColorCircle.setFill(targetColor.get());
    currentColorCircle.setVisible(isOn());

    pane = new Pane(barArc, ring, mainCircle, currentColorCircle, innerRing, indicatorGroup, buttonOn, textOn, buttonOff, textOff);
    pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setEffect(highlight);

    getChildren().setAll(pane);
}
 
源代码15 项目: Medusa   文件: SlimSkin.java
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);
        }
    }

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48590226, PREFERRED_HEIGHT * 0.48590226, 90, 360);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(gauge.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.ROUND);
    barBackground.setFill(null);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48590226, PREFERRED_HEIGHT * 0.48590226, 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(gauge.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    bar.setStrokeLineCap(StrokeLineCap.ROUND);
    bar.setFill(null);

    titleText = new Text(gauge.getTitle());
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFill(gauge.getValueColor());
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText = new Text(gauge.getUnit());
    unitText.setFill(gauge.getUnitColor());
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    pane = new Pane(barBackground, bar, titleText, valueText, unitText);
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
源代码16 项目: regulators   文件: FeedbackRegulator.java
private void initGraphics() {
    dropShadow  = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028);
    highlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    highlight.setInput(innerShadow);
    dropShadow.setInput(highlight);

    Stop[] stops = {
        new Stop(0.0, Color.rgb(135, 255, 190)),
        new Stop(0.125, Color.rgb(254, 190, 106)),
        new Stop(0.389, Color.rgb(252, 84, 68)),
        new Stop(0.611, Color.rgb(99, 195, 255)),
        new Stop(1.0, Color.rgb(125, 255, 190))
    };

    barGradient = new ConicalGradient(stops);

    barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    barArc.setType(ArcType.OPEN);
    barArc.setStrokeLineCap(StrokeLineCap.ROUND);
    barArc.setFill(null);
    barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT)));

    overlayBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    overlayBarArc.setType(ArcType.OPEN);
    overlayBarArc.setStrokeLineCap(StrokeLineCap.ROUND);
    overlayBarArc.setFill(null);
    overlayBarArc.setStroke(Color.rgb(0, 0, 0, 0.3));
    overlayBarArc.setVisible((int) targetValue.get() != (int) currentValue.get());

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42),
                          new Circle(center, center, PREFERRED_WIDTH * 0.3));
    ring.setFill(color.get());
    ring.setEffect(dropShadow);

    mainCircle = new Circle();
    mainCircle.setFill(color.get().darker().darker());

    text = new Text(String.format(Locale.US, formatString, currentValue.get()));
    text.setFill(textColor.get());
    text.setTextOrigin(VPos.CENTER);

    targetText = new Text(String.format(Locale.US, formatString, targetValue.get()));
    targetText.setFill(textColor.get().darker());
    targetText.setTextOrigin(VPos.CENTER);
    targetText.setVisible((int) targetValue.get() != (int) currentValue.get());

    indicatorRotate = new Rotate(-ANGLE_RANGE *  0.5, center, center);

    indicatorGlow        = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0);
    indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    indicatorHighlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    indicatorHighlight.setInput(indicatorInnerShadow);

    indicator = new Circle();
    indicator.setFill(color.get().darker());
    indicator.setStroke(color.get().darker().darker());
    indicator.setMouseTransparent(true);
    indicator.getTransforms().add(indicatorRotate);

    Group indicatorGroup = new Group(indicator);
    indicatorGroup.setEffect(indicatorHighlight);

    symbol = new Region();
    symbol.getStyleClass().setAll("symbol");
    symbol.setCacheHint(CacheHint.SPEED);

    icon = new FontIcon();
    icon.setTextOrigin(VPos.CENTER);

    iconPane = new StackPane(symbol, icon);

    pane = new Pane(barArc, overlayBarArc, ring, mainCircle, text, targetText, indicatorGroup, iconPane);
    pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setEffect(highlight);

    getChildren().setAll(pane);
}
 
源代码17 项目: Medusa   文件: SlimClockSkin.java
@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);
}
 
源代码18 项目: Medusa   文件: KpiSkin.java
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);
        }
    }

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(gauge.getBarColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    thresholdBar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, -angleRange * 0.5 + 90, 0);
    thresholdBar.setType(ArcType.OPEN);
    thresholdBar.setStroke(gauge.getThresholdColor());
    thresholdBar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    thresholdBar.setStrokeLineCap(StrokeLineCap.BUTT);
    thresholdBar.setFill(null);

    needleRotate = new Rotate((gauge.getValue() - oldValue - minValue) * angleStep);

    needle = new Path();
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);
    needle.setFill(gauge.getNeedleColor());
    needle.setStrokeWidth(0);
    needle.setStroke(Color.TRANSPARENT);

    titleText = new Text(gauge.getTitle());
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFill(gauge.getValueColor());
    Helper.enableNode(valueText, gauge.isValueVisible());

    minValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMinValue()));
    minValueText.setFill(gauge.getTitleColor());

    maxValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue()));
    maxValueText.setFill(gauge.getTitleColor());

    thresholdText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getThreshold()));
    thresholdText.setFill(gauge.getTitleColor());
    Helper.enableNode(thresholdText, Double.compare(gauge.getThreshold(), gauge.getMinValue()) != 0 && Double.compare(gauge.getThreshold(), gauge.getMaxValue()) != 0);

    pane = new Pane(barBackground, thresholdBar, needle, titleText, valueText, minValueText, maxValueText, thresholdText);
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
源代码19 项目: Medusa   文件: TinySkin.java
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);
        }
    }

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, ANGLE_RANGE * 0.5 + 90, -ANGLE_RANGE);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(gauge.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    sectionCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionCtx    = sectionCanvas.getGraphicsContext2D();

    needleRotate = new Rotate((gauge.getValue() - oldValue - minValue) * angleStep);

    needleMoveTo1        = new MoveTo();
    needleCubicCurveTo2  = new CubicCurveTo();
    needleCubicCurveTo3  = new CubicCurveTo();
    needleCubicCurveTo4  = new CubicCurveTo();
    needleCubicCurveTo5  = new CubicCurveTo();
    needleClosePath6     = new ClosePath();
    needleMoveTo7        = new MoveTo();
    needleCubicCurveTo8  = new CubicCurveTo();
    needleCubicCurveTo9  = new CubicCurveTo();
    needleCubicCurveTo10 = new CubicCurveTo();
    needleCubicCurveTo11 = new CubicCurveTo();
    needleClosePath12    = new ClosePath();
    needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleCubicCurveTo5, needleClosePath6,
                      needleMoveTo7, needleCubicCurveTo8, needleCubicCurveTo9, needleCubicCurveTo10, needleCubicCurveTo11, needleClosePath12);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);
    needle.setFill(gauge.getNeedleColor());
    needle.setStrokeType(StrokeType.INSIDE);
    needle.setStrokeWidth(1);
    needle.setStroke(gauge.getBackgroundPaint());

    needleTooltip = new Tooltip(String.format(locale, formatString, gauge.getValue()));
    needleTooltip.setTextAlignment(TextAlignment.CENTER);
    Tooltip.install(needle, needleTooltip);

    pane = new Pane(barBackground, sectionCanvas, needle);
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
源代码20 项目: JFoenix   文件: JFXSpinnerSkin.java
public JFXSpinnerSkin(JFXSpinner control) {
    super(control, new BehaviorBase<JFXSpinner>(control, Collections.emptyList()));

    this.control = control;

    blueColor = Color.valueOf("#4285f4");
    redColor = Color.valueOf("#db4437");
    yellowColor = Color.valueOf("#f4b400");
    greenColor = Color.valueOf("#0F9D58");

    arc = new Arc();
    arc.setManaged(false);
    arc.setStartAngle(0);
    arc.setLength(180);
    arc.getStyleClass().setAll("arc");
    arc.setFill(Color.TRANSPARENT);
    arc.setStrokeWidth(3);

    track = new Arc();
    track.setManaged(false);
    track.setStartAngle(0);
    track.setLength(360);
    track.setStrokeWidth(3);
    track.getStyleClass().setAll("track");
    track.setFill(Color.TRANSPARENT);

    fillRect = new Rectangle();
    fillRect.setFill(Color.TRANSPARENT);
    text = new Text();
    text.getStyleClass().setAll("text", "percentage");
    final Group group = new Group(fillRect, track, arc, text);
    group.setManaged(false);
    arcPane = new StackPane(group);
    arcPane.setPrefSize(50, 50);
    getChildren().setAll(arcPane);

    // register listeners
    registerChangeListener(control.indeterminateProperty(), "INDETERMINATE");
    registerChangeListener(control.progressProperty(), "PROGRESS");
    registerChangeListener(control.visibleProperty(), "VISIBLE");
    registerChangeListener(control.parentProperty(), "PARENT");
    registerChangeListener(control.sceneProperty(), "SCENE");
}