当前位置: 首页>>代码示例>>Java>>正文


Java Arc.setStrokeWidth方法代码示例

本文整理汇总了Java中javafx.scene.shape.Arc.setStrokeWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Arc.setStrokeWidth方法的具体用法?Java Arc.setStrokeWidth怎么用?Java Arc.setStrokeWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.shape.Arc的用法示例。


在下文中一共展示了Arc.setStrokeWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawSections

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
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);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:24,代码来源:IndicatorSkin.java

示例2: createIconContent

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:ArcSample.java

示例3: initGraphics

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
private void initGraphics() {
    sectionCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionCtx    = sectionCanvas.getGraphicsContext2D();

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.4, PREFERRED_HEIGHT * 0.4, model.getStartAngle() + 150, 300);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(model.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.125);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.4, PREFERRED_HEIGHT * 0.4, model.getStartAngle() + 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(model.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.125);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);

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

    valueText = new Text();
    valueText.setStroke(null);
    valueText.setFill(model.getValueColor());
    Helper.enableNode(valueText, model.isValueVisible());

    unitText = new Text();
    unitText.setStroke(null);
    unitText.setFill(model.getUnitColor());
    Helper.enableNode(unitText, model.isValueVisible() && !model.getUnit().isEmpty());

    pane = new Pane(barBackground, sectionCanvas, titleText, valueText, unitText, bar);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:SimpleSectionGauge,代码行数:39,代码来源:SimpleSectionGauge.java

示例4: JFXSpinnerSkin

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
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);

    fillRect = new Rectangle();
    fillRect.setFill(Color.TRANSPARENT);
    text = new Text();
    text.getStyleClass().setAll("text", "percentage");
    final Group group = new Group(fillRect, 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");
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:36,代码来源:JFXSpinnerSkin.java

示例5: createArc

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
/**
 * Kreisausschnitt für Symbol.
 *
 * @param radius
 *            Radius des Kreisausschnitts.
 * @param centerX
 *            x-Koordinate des Kreismittelpunkts.
 * @param centerY
 *            y-Koordinate des Kreismittelpunkts.
 * @return Kreisausschnitt als 2D Objekt
 */
private Arc createArc(final double radius, final double centerX, final double centerY) {
	final Arc arc = new Arc();
	arc.setCenterX(centerX);
	arc.setCenterY(centerY);
	arc.setRadiusX(radius);
	arc.setRadiusY(radius);
	arc.setStartAngle(START_ANGLE);
	arc.setLength(ARC_LENGTH);
	arc.setType(ArcType.OPEN);
	arc.setStrokeWidth(STROKE_WIDTH);
	arc.setStroke(Color.web(COLOR));
	arc.setFill(Color.TRANSPARENT);
	return arc;
}
 
开发者ID:Silent-Fred,项目名称:iTrySQL,代码行数:26,代码来源:DropTargetSymbol.java

示例6: drawTimeSections

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
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());
            }
        }
    }
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:42,代码来源:TimerControlTileSkin.java

示例7: initGraphics

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
@Override protected void initGraphics() {
    super.initGraphics();

    if (tile.isAutoScale()) tile.calcAutoScale();
    minValue             = tile.getMinValue();
    range                = tile.getRange();
    angleStep            = ANGLE_RANGE / range;
    sectionsVisible      = tile.getSectionsVisible();
    sections             = tile.getSections();
    formatString         = new StringBuilder("%.").append(Integer.toString(tile.getDecimals())).append("f").toString();
    locale               = tile.getLocale();
    currentValueListener = o -> setBar(tile.getCurrentValue());

    graphicListener      = (o, ov, nv) -> { if (nv != null) { graphicContainer.getChildren().setAll(tile.getGraphic()); }};

    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);

    percentageValueText = new Text(String.format(locale, formatString, tile.getCurrentValue()));
    percentageValueText.setFont(Fonts.latoRegular(PREFERRED_WIDTH * 0.27333));
    percentageValueText.setFill(tile.getValueColor());
    percentageValueText.setTextOrigin(VPos.CENTER);

    percentageUnitText = new Text(tile.getUnit());
    percentageUnitText = new Text("\u0025");
    percentageUnitText.setFont(Fonts.latoLight(PREFERRED_WIDTH * 0.08));
    percentageUnitText.setFill(tile.getUnitColor());

    percentageFlow = new TextFlow(percentageValueText, percentageUnitText);
    percentageFlow.setTextAlignment(TextAlignment.CENTER);

    valueText = new Text(String.format(locale, formatString, tile.getCurrentValue()));
    valueText.setFont(Fonts.latoRegular(PREFERRED_WIDTH * 0.27333));
    valueText.setFill(tile.getValueColor());
    valueText.setTextOrigin(VPos.CENTER);
    enableNode(valueText, tile.isValueVisible());

    unitText = new Text(tile.getUnit());
    unitText = new Text("\u0025");
    unitText.setFont(Fonts.latoLight(PREFERRED_WIDTH * 0.08));
    unitText.setFill(tile.getUnitColor());
    enableNode(unitText, !tile.getUnit().isEmpty());

    valueUnitFlow = new TextFlow(valueText, unitText);
    valueUnitFlow.setTextAlignment(TextAlignment.CENTER);

    graphicContainer = new StackPane();
    graphicContainer.setMinSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795);
    graphicContainer.setMaxSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795);
    graphicContainer.setPrefSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795);
    if (null == tile.getGraphic()) {
        enableNode(graphicContainer, false);
    } else {
        graphicContainer.getChildren().setAll(tile.getGraphic());
    }

    getPane().getChildren().addAll(barBackground, bar, separator, titleText, text, graphicContainer, percentageFlow, valueUnitFlow);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:82,代码来源:CircularProgressTileSkin.java

示例8: 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);
        }
    }

    shadow     = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 12, 0, 3, 3);
    textShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 4, 0, 2, 2);

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFill(Color.WHITE);
    valueText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.20625));
    valueText.setTextOrigin(VPos.CENTER);
    valueText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.46875);
    valueText.setEffect(textShadow);
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText  = new Text(gauge.getUnit());
    unitText.setFill(Color.WHITE);
    unitText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.0875));
    unitText.setTextOrigin(VPos.CENTER);
    unitText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.65625);
    unitText.setEffect(textShadow);
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    backgroundRing = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                             PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                             0, 360);
    backgroundRing.setFill(null);
    backgroundRing.setStroke(Color.rgb(255, 255, 255, 0.9));
    backgroundRing.setStrokeLineCap(StrokeLineCap.BUTT);
    backgroundRing.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
    backgroundRing.setEffect(shadow);

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                            PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                            0, 360);
    barBackground.setFill(null);
    barBackground.setStroke(Color.rgb(255, 255, 255, 0.4));
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.1375);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                  PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                  90, -gauge.getAngleStep() * gauge.getValue());
    bar.setFill(null);
    bar.setStroke(Color.WHITE);
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);

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

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:62,代码来源:WhiteSkin.java

示例9: resize

import javafx.scene.shape.Arc; //导入方法依赖的package包/类
@Override protected void resize() {
    double width  = gauge.getWidth() - gauge.getInsets().getLeft() - gauge.getInsets().getRight();
    double height = gauge.getHeight() - gauge.getInsets().getTop() - gauge.getInsets().getBottom();
    size          = width < height ? width : height;

    if (width > 0 && height > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((width - size) * 0.5, (height - size) * 0.5);

        shadow.setRadius(size * 0.06);
        shadow.setOffsetX(size * 0.02);
        shadow.setOffsetY(size * 0.02);

        textShadow.setRadius(size * 0.0125);
        textShadow.setOffsetX(size * 0.00625);
        textShadow.setOffsetY(size * 0.00625);

        center = size * 0.5;

        valueText.setFont(Fonts.robotoBold(size * 0.20625));

        unitText.setFont(Fonts.robotoBold(size * 0.0875));

        Arc outerRing = new Arc(size * 0.5, size * 0.5,
                                size * 0.43125, size * 0.43125,
                                0, 360);
        outerRing.setFill(null);
        outerRing.setStroke(Color.WHITE);
        outerRing.setStrokeLineCap(StrokeLineCap.BUTT);
        outerRing.setStrokeWidth(size * 0.3);

        Arc innerRing = new Arc(size * 0.5, size * 0.5,
                                size * 0.43125, size * 0.43125,
                                0, 360);
        innerRing.setFill(null);
        innerRing.setStroke(Color.WHITE);
        innerRing.setStrokeLineCap(StrokeLineCap.BUTT);
        innerRing.setStrokeWidth(size * 0.1375);

        Shape shape = Shape.subtract(outerRing, innerRing);

        backgroundRing.setCenterX(center);
        backgroundRing.setCenterY(center);
        backgroundRing.setRadiusX(size * 0.43125);
        backgroundRing.setRadiusY(size * 0.43125);
        backgroundRing.setStrokeWidth(size * 0.1375);
        backgroundRing.setClip(shape);

        barBackground.setCenterX(center);
        barBackground.setCenterY(center);
        barBackground.setRadiusX(size * 0.43125);
        barBackground.setRadiusY(size * 0.43125);
        barBackground.setStrokeWidth(size * 0.1375);

        bar.setCenterX(center);
        bar.setCenterY(center);
        bar.setRadiusX(size * 0.43125);
        bar.setRadiusY(size * 0.43125);
        bar.setStrokeWidth(size * 0.1375);

        resizeValueText();
        resizeUnitText();
    }
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:65,代码来源:WhiteSkin.java

示例10: 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);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:52,代码来源:SlimClockSkin.java

示例11: 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);
        }
    }

    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);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:59,代码来源:KpiSkin.java

示例12: 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);
        }
    }

    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);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:55,代码来源:TinySkin.java

示例13: 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);
        }
    }

    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.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    sectionLayer = new Pane();
    sectionLayer.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(gauge.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);
    //bar.setMouseTransparent(sectionsAlwaysVisible ? true : false);
    bar.setVisible(!sectionsAlwaysVisible);

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

    needleMoveTo1       = new MoveTo();
    needleCubicCurveTo2 = new CubicCurveTo();
    needleCubicCurveTo3 = new CubicCurveTo();
    needleCubicCurveTo4 = new CubicCurveTo();
    needleCubicCurveTo5 = new CubicCurveTo();
    needleCubicCurveTo6 = new CubicCurveTo();
    needleCubicCurveTo7 = new CubicCurveTo();
    needleClosePath8    = new ClosePath();
    needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleCubicCurveTo5, needleCubicCurveTo6, needleCubicCurveTo7, needleClosePath8);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);
    needle.setFill(gauge.getNeedleColor());
    needle.setPickOnBounds(false);
    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);

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

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

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

    if (!sections.isEmpty() && sectionsVisible && !sectionsAlwaysVisible) {
        barTooltip = new Tooltip();
        barTooltip.setTextAlignment(TextAlignment.CENTER);
        Tooltip.install(bar, barTooltip);
    }

    pane = new Pane(barBackground, sectionLayer, bar, needle, minValueText, maxValueText, titleText);
    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);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:78,代码来源:IndicatorSkin.java

示例14: 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);
        }
    }

    colorRing = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.5);
    colorRing.setFill(Color.TRANSPARENT);
    colorRing.setStrokeWidth(PREFERRED_WIDTH * 0.0075);
    colorRing.setStroke(gauge.getBarColor());

    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(gauge.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.15);
    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(gauge.getBorderPaint());
    separator.setFill(Color.TRANSPARENT);

    titleText = new Text(gauge.getTitle());
    titleText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.08));
    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(colorRing, bar, separator, titleText, valueText, unitText);
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:49,代码来源:FlatSkin.java

示例15: 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);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:49,代码来源:MinimalClockSkin.java


注:本文中的javafx.scene.shape.Arc.setStrokeWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。