Java 类javafx.scene.shape.StrokeLineCap 实例源码

项目:lttng-scope    文件:UiModelApp2.java   
private static void drawSelection(Group parent, Pane content) {
//        Rectangle selection1 = new Rectangle();
        Rectangle selection2 = new Rectangle();

        Stream.of(selection2).forEach(rect -> {
            rect.setMouseTransparent(true);

            rect.setStroke(SELECTION_STROKE_COLOR);
            rect.setStrokeWidth(SELECTION_STROKE_WIDTH);
            rect.setStrokeLineCap(StrokeLineCap.ROUND);
            rect.setFill(SELECTION_FILL_COLOR);

            rect.yProperty().bind(JfxUtils.ZERO_PROPERTY);
            rect.heightProperty().bind(content.heightProperty());
        });
//
//        selection1.setX(200);
//        selection1.setWidth(100);

        selection2.setX(500);
        selection2.setWidth(500);

        parent.getChildren().addAll(selection2);
    }
项目:lttng-scope    文件:UiModelApp.java   
private static void drawSelection(Group parent, Pane content) {
    Rectangle selection1 = new Rectangle();
    Rectangle selection2 = new Rectangle();

    Stream.of(selection1, selection2).forEach(rect -> {
        rect.setMouseTransparent(true);

        rect.setStroke(SELECTION_STROKE_COLOR);
        rect.setStrokeWidth(SELECTION_STROKE_WIDTH);
        rect.setStrokeLineCap(StrokeLineCap.ROUND);
        rect.setFill(SELECTION_FILL_COLOR);

        rect.yProperty().bind(JfxUtils.ZERO_PROPERTY);
        rect.heightProperty().bind(content.heightProperty());
    });

    selection1.setX(200);
    selection1.setWidth(100);

    selection2.setX(PANE_WIDTH - 1000);
    selection2.setWidth(500);

    parent.getChildren().addAll(selection1, selection2);
}
项目:circularplot    文件:CircularPlot.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    getStyleClass().add("circular-plot");

    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx    = canvas.getGraphicsContext2D();

    ctx.setLineCap(StrokeLineCap.BUTT);

    getChildren().setAll(canvas);
}
项目:charts    文件:CoxcombChart.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    getStyleClass().add("coxcomb-chart");

    popup = new InfoPopup();

    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx    = canvas.getGraphicsContext2D();

    ctx.setLineCap(StrokeLineCap.BUTT);
    ctx.setTextBaseline(VPos.CENTER);
    ctx.setTextAlign(TextAlignment.CENTER);

    pane = new Pane(canvas);

    getChildren().setAll(pane);
}
项目:charts    文件:CircularPlot.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx    = canvas.getGraphicsContext2D();

    ctx.setLineCap(StrokeLineCap.BUTT);

    tooltip = new Tooltip();
    tooltip.setAutoHide(true);

    getChildren().setAll(canvas);
}
项目:Game-Engine-Vooga    文件:BezierCurve.java   
/**
 * Creates the starting Bezier curve and its controls.
 * @return
 */
CubicCurve createStartingCurve() {
    curve = new CubicCurve();
    curve.setStartX(START_X);
    curve.setStartY(START_Y);
    curve.setControlX1(CONTROL_X1);
    curve.setControlY1(CONTROL_Y1);
    curve.setControlX2(CONTROL_X2);
    curve.setControlY2(CONTROL_Y2);
    curve.setEndX(END_X);
    curve.setEndY(END_Y);
    curve.setStroke(Color.CADETBLUE);
    curve.setStrokeWidth(WIDTH);
    curve.setStrokeLineCap(StrokeLineCap.ROUND);
    curve.setFill(Color.CORNSILK.deriveColor(0, SATURATION_FACTOR, 1, OPACITY_FACTOR));
    this.getChildren().add(curve);
    return curve;
}
项目:medusademo    文件:InteractiveGaugeSkin.java   
private void drawGradientBar() {
    double     xy     = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.115 * size : 0.0515 * size;
    double     wh     = TickLabelLocation.OUTSIDE == tickLabelLocation ? size * 0.77 : size * 0.897;
    double     offset = 90 - startAngle;
    List<Stop> stops  = getSkinnable().getGradientBarStops();
    Map<Double, Color> stopAngleMap     = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double                  offsetFactor        = ScaleDirection.CLOCKWISE == scaleDirection ? (startAngle - 90) : (startAngle + 180);
    AngleConicalGradient    gradient            = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, getSkinnable().getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? getSkinnable().getRange() * angleStep : -getSkinnable().getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * size, xy - 0.026 * size, wh + 0.052 * size, wh + 0.052 * size)));
    tickMarkCtx.setLineWidth(size * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:openjfx-8u-dev-tests    文件:CanvasShapePathElements2App.java   
@Override
public Node drawNode() {
    Pane slot = new Pane();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    effect.setEffect(gc, slot);

    gc.setLineCap(StrokeLineCap.ROUND);
    gc.fillArc(DEFAULT_ARC_X /2 , DEFAULT_ARC_Y /2 ,
            2*DEFAULT_ARC_RADIUS_X, 2*DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH,ArcType.CHORD);
    gc.stroke();

    return slot;

}
项目:openjfx-8u-dev-tests    文件:CanvasShapePathElements2App.java   
@Override
public Node drawNode() {

    Pane slot = new Pane();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    gc.setLineCap(StrokeLineCap.ROUND);
    gc.arc(DEFAULT_ARC_X  , DEFAULT_ARC_Y ,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    gc.stroke();
    effect.setEffect(gc, slot);

    return slot;

}
项目:openjfx-8u-dev-tests    文件:CanvasShapePathElements2App.java   
@Override
public Node drawNode() {
    Pane slot = new Pane();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    effect.setEffect(gc, slot);

    gc.setLineCap(StrokeLineCap.ROUND);
    gc.fillArc(DEFAULT_ARC_X /2 , DEFAULT_ARC_Y /2,
            2*DEFAULT_ARC_RADIUS_X, 2*DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH, ArcType.ROUND);
    gc.stroke();

    return slot;

}
项目:openjfx-8u-dev-tests    文件:CanvasShapePathElements2App.java   
@Override
public Node drawNode() {
    Pane slot = new Pane();
    final Canvas canvas = new Canvas(120, 120);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    effect.setEffect(gc, slot);

    gc.setLineCap(StrokeLineCap.ROUND);
    gc.fillArc(DEFAULT_ARC_X /2 , DEFAULT_ARC_Y /2,
            2*DEFAULT_ARC_RADIUS_X, 2*DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH, ArcType.ROUND);
    gc.arc(DEFAULT_ARC_X  , DEFAULT_ARC_Y ,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    gc.stroke();

    return slot;
}
项目:Medusa    文件:HSkin.java   
private void drawGradientBar() {
    double     scaledWidth = width * 0.9;
    double     xy          = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.1705 * scaledWidth : 0.107 * scaledWidth;
    double     wh          = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledWidth * 0.77 : scaledWidth * 0.897;
    double     offsetY     = -0.1 * height;
    double     offset      = 90 - startAngle;
    List<Stop> stops       = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? startAngle - angleRange + 180 : (startAngle + 180);
    AngleConicalGradient gradient     = new AngleConicalGradient(width * 0.5, width * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * width, xy - 0.026 * width + offsetY, wh + 0.052 * width, wh + 0.052 * width)));
    tickMarkCtx.setLineWidth(scaledWidth * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy + offsetY, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:RoundLcdClockSkin.java   
private void drawHours(final ZonedDateTime TIME) {
    int hourCounter = 1;
    int hour        = TIME.getHour();
    double strokeWidth = size * 0.06;
    hoursCtx.setLineCap(StrokeLineCap.BUTT);
    hoursCtx.clearRect(0, 0, size, size);
    for (int i = 450 ; i >= 90 ; i--) {
        hoursCtx.save();
        if (i % 30 == 0) {
            //draw hours
            hoursCtx.setStroke(hourColor);
            hoursCtx.setLineWidth(strokeWidth);
            if (hour == 0 || hour == 12) {
                hoursCtx.strokeArc(strokeWidth * 0.5, strokeWidth * 0.5, size - strokeWidth, size - strokeWidth, i + 1 - 30, 28, ArcType.OPEN);
            } else if (hourCounter <= (TIME.get(ChronoField.AMPM_OF_DAY) == 1 ? hour - 12 : hour)) {
                hoursCtx.strokeArc(strokeWidth * 0.5, strokeWidth * 0.5, size - strokeWidth, size - strokeWidth, i + 1 - 30, 28, ArcType.OPEN);
                hourCounter++;
            }
        }
        hoursCtx.restore();
    }
}
项目:Medusa    文件:RoundLcdClockSkin.java   
private void drawMinutes(final ZonedDateTime TIME) {
    int minCounter  = 1;
    double strokeWidth = size * 0.06;
    minutesCtx.clearRect(0, 0, size, size);
    minutesCtx.setLineCap(StrokeLineCap.BUTT);
    for (int i = 450 ; i >= 90 ; i--) {
        minutesCtx.save();
        if (i % 6 == 0) {
            // draw minutes
            if (minCounter <= TIME.getMinute()) {
                minutesCtx.setStroke(minCounter % 5 == 0 ? fiveMinuteColor : minuteColor);
                minutesCtx.setLineWidth(strokeWidth);
                minutesCtx.strokeArc(strokeWidth * 0.5 + strokeWidth * 1.1, strokeWidth * 0.5 + strokeWidth * 1.1, size - strokeWidth - strokeWidth * 2.2, size - strokeWidth - strokeWidth * 2.2, i + 1 - 6, 4, ArcType.OPEN);
                minCounter++;
            }
        }
        minutesCtx.restore();
    }
}
项目:Medusa    文件:RoundLcdClockSkin.java   
private void drawSeconds(final ZonedDateTime TIME) {
    int secCounter  = 1;
    double strokeWidth = size * 0.06;
    secondsCtx.setLineCap(StrokeLineCap.BUTT);
    secondsCtx.clearRect(0, 0, size, size);
    for (int i = 450 ; i >= 90 ; i--) {
        secondsCtx.save();
        if (i % 6 == 0) {
            // draw seconds
            if (secCounter <= TIME.getSecond() + 1) {
                secondsCtx.setStroke(secondColor);
                secondsCtx.setLineWidth(strokeWidth * 0.25);
                secondsCtx.strokeArc(strokeWidth * 0.5 + strokeWidth * 1.8, strokeWidth * 0.5 + strokeWidth * 1.8, size - strokeWidth - strokeWidth * 3.6, size - strokeWidth - strokeWidth * 3.6, i + 1 - 6, 4, ArcType.OPEN);
                secCounter++;
            }
        }
        secondsCtx.restore();
    }
}
项目:Medusa    文件:QuarterSkin.java   
private void drawGradientBar() {
    Pos                knobPosition      = gauge.getKnobPosition();
    TickLabelLocation  tickLabelLocation = gauge.getTickLabelLocation();
    double             scaledSize        = size * 1.9;
    double             xy                = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.105 * scaledSize : 0.03875 * scaledSize;
    double             wh                = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledSize * 0.79 : scaledSize * 0.925;
    double             offsetX           = Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_LEFT == knobPosition ? -scaledSize * 0.475 : 0;
    double             offsetY           = Pos.TOP_LEFT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.475 : 0;
    double             offset            = 90 - startAngle;
    ScaleDirection     scaleDirection    = gauge.getScaleDirection();
    List<Stop>         stops             = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap      = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * ANGLE_RANGE, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? (Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_RIGHT == knobPosition ? startAngle : 180 - startAngle) : (startAngle + 180);
    AngleConicalGradient gradient     = new AngleConicalGradient(scaledSize * 0.5, scaledSize * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * scaledSize + offsetX, xy - 0.026 * scaledSize + offsetY, wh + 0.052 * scaledSize, wh + 0.052 * scaledSize)));
    tickMarkCtx.setLineWidth(scaledSize * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy + offsetX, xy + offsetY, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:VSkin.java   
private void drawGradientBar() {
    TickLabelLocation  tickLabelLocation     = gauge.getTickLabelLocation();
    double             scaledHeight          = height * 0.9;
    double             xy                    = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.1705 * scaledHeight : 0.107 * scaledHeight;
    double             wh                    = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledHeight * 0.77 : scaledHeight * 0.897;
    double             offset                = 90 - startAngle;
    double             offsetX               = -0.1 * width;
    double             knobPositionOffsetCW  = Pos.CENTER_LEFT == gauge.getKnobPosition() ? 90 : 270;
    double             knobPositionOffsetCCW = Pos.CENTER_LEFT == gauge.getKnobPosition() ? 180 : 0;
    ScaleDirection     scaleDirection        = gauge.getScaleDirection();
    List<Stop>         stops                 = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap          = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double               offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? knobPositionOffsetCW - angleRange * 0.5 : angleRange - (angleRange / 180 * angleRange) + knobPositionOffsetCCW;
    AngleConicalGradient gradient     = new AngleConicalGradient(width * 0.5, width * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * height + offsetX, xy - 0.026 * height, wh + 0.052 * height, wh + 0.052 * height)));
    tickMarkCtx.setLineWidth(scaledHeight * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy + offsetX, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:GaugeSkin.java   
private void drawGradientBar() {
    double     xy     = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.115 * size : 0.0515 * size;
    double     wh     = TickLabelLocation.OUTSIDE == tickLabelLocation ? size * 0.77 : size * 0.897;
    double     offset = 90 - startAngle;
    List<Stop> stops  = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap     = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * angleRange, stop.getColor()); }
    double                  offsetFactor        = ScaleDirection.CLOCKWISE == scaleDirection ? (startAngle - 90) : (startAngle + 180);
    AngleConicalGradient    gradient            = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection());

    double barStartAngle  = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep;
    double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep;
    tickMarkCtx.save();
    tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * size, xy - 0.026 * size, wh + 0.052 * size, wh + 0.052 * size)));
    tickMarkCtx.setLineWidth(size * 0.052);
    tickMarkCtx.setLineCap(StrokeLineCap.BUTT);
    tickMarkCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    tickMarkCtx.restore();
}
项目:Medusa    文件:TinySkin.java   
private void drawGradientBar() {
    double             xy           = size * 0.1875;
    double             wh           = size * 0.625;
    double             offset       = -ANGLE_RANGE * 0.5 - 90;
    double             startAngle   = 315;
    List<Stop>         stops        = gauge.getGradientBarStops();
    Map<Double, Color> stopAngleMap = new HashMap<>(stops.size());
    for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * ANGLE_RANGE, stop.getColor()); }
    double               offsetFactor = startAngle - 90;
    AngleConicalGradient gradient     = new AngleConicalGradient(size * 0.5, size * 0.5, offsetFactor, stopAngleMap, ScaleDirection.CLOCKWISE);

    double barStartAngle  = 0;
    double barAngleExtend = 270;
    sectionCtx.save();
    sectionCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.09191176 * size, xy - 0.09191176 * size, wh + 0.18382353 * size, wh + 0.18382353 * size)));
    sectionCtx.setLineWidth(size * 0.18382353);
    sectionCtx.setLineCap(StrokeLineCap.BUTT);
    sectionCtx.strokeArc(xy, xy, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN);
    sectionCtx.restore();    
}
项目: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);
}
项目:urmusic-desktop    文件:AnalyserSection.java   
public void set(PrimitiveProperties p) {
    this.dataCount.setExpr(p.getString("dataCount", "128"));
    this.lineWidth.setExpr(p.getString("lineWidth", "1"));
    this.lineCap = StrokeLineCap.valueOf(p.getString("lineCap", "BUTT").toUpperCase());
    this.startX.setExpr(p.getString("startX", "-1"));
    this.endX.setExpr(p.getString("endX", "1"));
    this.offsetY.setExpr(p.getString("offsetY", p.getString("yPos", "0"))); // offsetY was yPos back in the times
    this.exponent.setExpr(p.getString("exponent", "1"));
    this.height.setExpr(p.getString("height", "0.5"));
    this.mode = DrawMode.valueOf(p.getString("mode", "LINES").toUpperCase());
    this.polar.setExpr(p.getString("polar", "0"));
    this.clampShapeToZero = p.getBool("clampShapeToZero", true);
    this.closeShape = p.getBool("closeShape", true);
    this.drawLast = p.getBool("drawLast", true);
    this.quadratic = p.getBool("quadratic", true);
    this.smartFill = p.getBool("smartFill", false);
}
项目:org.csstudio.display.builder    文件:WidgetColorPropertyField.java   
/** @param color Color to display */
public void setColor(final WidgetColor color)
{
    final GraphicsContext gc = blob.getGraphicsContext2D();

    gc.setFill(JFXUtil.convert(color));
    gc.fillRect(0, 0, 16, 16);

    gc.setLineCap(StrokeLineCap.SQUARE);
    gc.setLineJoin(StrokeLineJoin.MITER);
    gc.setLineWidth(1.75);
    gc.setStroke(Color.BLACK);
    gc.strokeRect(0, 0, 16, 16);

    button.setText(String.valueOf(color));
}
项目:JavaFxNodeToSvg    文件:SvgNodeProperties.java   
/**
 * Sets the stroke line cap with a JavaFx stroke line cap
 * @param javaFxStrokeLineCap 
 */
public void setStrokeLineCap(StrokeLineCap javaFxStrokeLineCap) {
    switch (javaFxStrokeLineCap) {
    case BUTT:
        setStrokeLineCap(SvgStrokeLineCap.BUTT);
        break;
    case ROUND:
        setStrokeLineCap(SvgStrokeLineCap.ROUND);
        break;
    case SQUARE:
        setStrokeLineCap(SvgStrokeLineCap.SQUARE);
        break;
    default:
        String message = "The line cap " + javaFxStrokeLineCap + " is not known.";
        throw new IllegalArgumentException(message);
    }
}
项目:afc    文件:MapPolylineDrawer.java   
@Override
public void draw(ZoomableGraphicsContext gc, MapPolyline element) {
    definePath(gc, element);

    final Color color = gc.rgb(getDrawingColor(element));
    gc.setFill(null);
    gc.setStroke(color);
    if (element.isWidePolyline()) {
        gc.setLineWidthInMeters(element.getWidth());
    } else {
        gc.setLineWidthInPixels(1);
    }
    gc.setLineCap(StrokeLineCap.ROUND);
    gc.setLineJoin(StrokeLineJoin.ROUND);
    gc.stroke();
}
项目:afc    文件:RoadPolylineDrawer.java   
@Override
public void draw(ZoomableGraphicsContext gc, RoadPolyline element) {
    definePath(gc, element);

    gc.setFill(null);
    gc.setLineCap(StrokeLineCap.ROUND);
    gc.setLineJoin(StrokeLineJoin.ROUND);

    switch (gc.getState()) {
    case RoadNetworkDrawerConstants.DRAWING_STATE_ROAD_BORDERS:
        setupRoadBorders(gc, element);
        break;
    case RoadNetworkDrawerConstants.DRAWING_STATE_ROAD_INTERIOR:
        setupRoadInterior(gc, element);
        break;
    case RoadNetworkDrawerConstants.DRAWING_STATE_ROAD_DETAILS:
        setupRoadDetails(gc, element);
        break;
    default:
    }

    gc.stroke();
}
项目:lttng-scope    文件:ExampleMouseDrag2.java   
public RubberBandSelection( Pane group) {

            this.group = group;

            rect = new Rectangle( 0,0,0,0);
            rect.setStroke(Color.BLUE);
            rect.setStrokeWidth(1);
            rect.setStrokeLineCap(StrokeLineCap.ROUND);
            rect.setFill(Color.LIGHTBLUE.deriveColor(0, 1.2, 1, 0.6));

            group.addEventHandler(MouseEvent.MOUSE_PRESSED, onMousePressedEventHandler);
            group.addEventHandler(MouseEvent.MOUSE_DRAGGED, onMouseDraggedEventHandler);
            group.addEventHandler(MouseEvent.MOUSE_RELEASED, onMouseReleasedEventHandler);

        }
项目:lttng-scope    文件:TimeGraphSelectionLayer.java   
/**
 * Constructor
 *
 * @param widget
 *            The corresponding time graph widget
 * @param parentGroup
 *            The group to which this layer should add its children
 */
public TimeGraphSelectionLayer(TimeGraphWidget widget, Group parentGroup) {
    super(widget, parentGroup);

    final Pane timeGraphPane = getWidget().getTimeGraphPane();

    fSelectionRect.setStroke(SELECTION_STROKE_COLOR);
    fSelectionRect.setStrokeWidth(SELECTION_STROKE_WIDTH);
    fSelectionRect.setStrokeLineCap(StrokeLineCap.ROUND);

    Stream.of(fSelectionRect, fOngoingSelectionRect).forEach(rect -> {
        rect.setMouseTransparent(true);
        rect.setFill(SELECTION_FILL_COLOR);

        /*
         * We keep the 'x' property at 0, and we'll use 'layoutX' to set the
         * start position of the rectangles.
         *
         * See https://github.com/lttng/lttng-scope/issues/25
         */
        rect.xProperty().bind(JfxUtils.ZERO_PROPERTY);
        rect.yProperty().bind(JfxUtils.ZERO_PROPERTY);
        rect.heightProperty().bind(timeGraphPane.heightProperty());
    });

    /*
     * Note, unlike most other controls, we will not add/remove children to
     * the target group, we will add them once then toggle their 'visible'
     * property.
     */
    fSelectionRect.setVisible(true);
    fOngoingSelectionRect.setVisible(false);
    getParentGroup().getChildren().addAll(fSelectionRect, fOngoingSelectionRect);

    timeGraphPane.addEventHandler(MouseEvent.MOUSE_PRESSED, fSelectionCtx.fMousePressedEventHandler);
    timeGraphPane.addEventHandler(MouseEvent.MOUSE_DRAGGED, fSelectionCtx.fMouseDraggedEventHandler);
    timeGraphPane.addEventHandler(MouseEvent.MOUSE_RELEASED, fSelectionCtx.fMouseReleasedEventHandler);
}
项目:ExtremeGuiMakeover    文件:AnimatedIcon.java   
public AnimatedIcon() {
    iconFill = new SimpleObjectProperty<>(Color.ORANGE);

    line1 = new Line(4, 8, 28, 8);
    line1.setStrokeWidth(3);
    line1.strokeProperty().bind(iconFill);
    line1.setManaged(false);
    line1.setStrokeLineCap(StrokeLineCap.ROUND);

    line2 = new Line(4, 16, 28, 16);
    line2.setStrokeWidth(3);
    line2.strokeProperty().bind(iconFill);
    line2.setManaged(false);
    line2.setStrokeLineCap(StrokeLineCap.ROUND);

    line3 = new Line(4, 24, 28, 24);
    line3.setStrokeWidth(3);
    line3.strokeProperty().bind(iconFill);
    line3.setManaged(false);
    line3.setStrokeLineCap(StrokeLineCap.ROUND);

    getChildren().addAll(line1, line2, line3);
    setPrefWidth(32);
    setPrefHeight(32);
    setMinWidth(USE_PREF_SIZE);
    setMinHeight(USE_PREF_SIZE);
    setMaxWidth(USE_PREF_SIZE);
    setMaxHeight(USE_PREF_SIZE);
}
项目:ccu-historian    文件:FXGraphics2D.java   
/**
 * Maps a line cap code from AWT to the corresponding JavaFX StrokeLineCap
 * enum value.
 * 
 * @param c  the line cap code.
 * 
 * @return A JavaFX line cap value. 
 */
private StrokeLineCap awtToJavaFXLineCap(int c) {
    if (c == BasicStroke.CAP_BUTT) {
        return StrokeLineCap.BUTT;
    } else if (c == BasicStroke.CAP_ROUND) {
        return StrokeLineCap.ROUND;
    } else if (c == BasicStroke.CAP_SQUARE) {
        return StrokeLineCap.SQUARE;
    } else {
        throw new IllegalArgumentException("Unrecognised cap code: " + c);
    }
}
项目:tilesfx    文件:GaugeSparkLineTileSkin.java   
private void drawHighLightSections(final double VALUE) {
    highlightSectionCtx.setLineCap(StrokeLineCap.BUTT);
    highlightSectionCtx.clearRect(0, 0, width, height);

    if (tile.getSectionsVisible() && !sections.isEmpty()) {
        double  x         = (width - size * 0.7) * 0.5;
        double  y         = (height - size * 0.7) * 0.5;
        double  wh        = size * 0.7;
        double  minValue  = tile.getMinValue();
        double  maxValue  = tile.getMaxValue();
        double  angleStep = tile.getAngleStep();
        highlightSectionCtx.setLineWidth(size * 0.01);
        highlightSectionCtx.setLineCap(StrokeLineCap.BUTT);
        for (int i = 0; i < sections.size(); i++) {
            Section section = sections.get(i);
            double sectionStartAngle;
            if (Double.compare(section.getStart(), maxValue) <= 0 && Double.compare(section.getStop(), minValue) >= 0) {
                if (Double.compare(section.getStart(), minValue) < 0 && Double.compare(section.getStop(), maxValue) < 0) {
                    sectionStartAngle = 15;
                } else {
                    sectionStartAngle = (section.getStart() - minValue) * angleStep + 15;
                }
                double sectionAngleExtend;
                if (Double.compare(section.getStop(), maxValue) > 0) {
                    sectionAngleExtend = (maxValue - section.getStart()) * angleStep;
                } else if (Double.compare(section.getStart(), minValue) < 0) {
                    sectionAngleExtend = (section.getStop() - minValue) * tile.getAngleStep();
                } else {
                    sectionAngleExtend = (section.getStop() - section.getStart()) * angleStep;
                }
                highlightSectionCtx.save();
                highlightSectionCtx.setStroke(section.contains(VALUE) ? section.getColor() : section.getColor().darker().darker());
                highlightSectionCtx.strokeArc(x, y, wh, wh, -(120 + sectionStartAngle), -sectionAngleExtend, ArcType.OPEN);
                highlightSectionCtx.restore();
            }
        }
    }
}
项目:FxEditor    文件:CssTools.java   
public static String toValue(StrokeLineCap x)
{
    switch(x)
    {
    case BUTT: return "butt";
    case ROUND: return "round";
    case SQUARE: return "square";
    }
    throw new Error("?" + x);
}
项目:SimpleSectionGauge    文件:SimpleSectionGauge.java   
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);
}
项目:Game-Engine-Vooga    文件:BoundLine.java   
/**
 * Initializes the line and its starting and ending coordinates.
 * @param startX
 * @param startY
 * @param endX
 * @param endY
 */
BoundLine(DoubleProperty startX, DoubleProperty startY, DoubleProperty endX, DoubleProperty endY) {
    startXProperty().bind(startX);
    startYProperty().bind(startY);
    endXProperty().bind(endX);
    endYProperty().bind(endY);
    setStrokeWidth(STROKE_WIDTH);
    setStroke(Color.GRAY.deriveColor(0, 1, 1, OPACITY));
    setStrokeLineCap(StrokeLineCap.BUTT);
    getStrokeDashArray().setAll(DASH1, DASH2);
}
项目:Gargoyle    文件:LineDrawItemSkin.java   
@Override
public void draw(Line line) {
    line.setStartX(0d);
    line.setStartY(0d);
    line.setEndX(200d);
    line.setEndY(200d);

    line.setStrokeWidth(10);
    line.setStrokeLineCap(StrokeLineCap.BUTT);
    line.getStrokeDashArray().addAll(15d, 5d, 15d, 15d, 20d);
    line.setStrokeDashOffset(10);

}
项目:Forum-Notifier    文件:XpathDisplayBlock.java   
public XpathDisplayBlock() {
    xpathPane = new AnchorPane();
    xpathPane.setPrefSize(300, 10);

    divider = new Rectangle(150, 0, Color.TRANSPARENT);
    divider.setStroke(Color.web("#303030"));
    divider.setStrokeLineCap(StrokeLineCap.ROUND);
    divider.setTranslateX(35);
    divider.setTranslateY(4);

    xpathPane.getChildren().add(divider);
}
项目:aya-lang    文件:FXGraphics2D.java   
/**
 * Maps a line cap code from AWT to the corresponding JavaFX StrokeLineCap
 * enum value.
 * 
 * @param c  the line cap code.
 * 
 * @return A JavaFX line cap value. 
 */
private StrokeLineCap awtToJavaFXLineCap(int c) {
    if (c == BasicStroke.CAP_BUTT) {
        return StrokeLineCap.BUTT;
    } else if (c == BasicStroke.CAP_ROUND) {
        return StrokeLineCap.ROUND;
    } else if (c == BasicStroke.CAP_SQUARE) {
        return StrokeLineCap.SQUARE;
    } else {
        throw new IllegalArgumentException("Unrecognised cap code: " + c);
    }
}
项目:Synth    文件:CurveCable.java   
public CurveCable() {
    super();
    setId(UUID.randomUUID().toString());

    // Modify the control points as the coordinate of the curve change
    startXProperty().addListener((observable, oldValue, newValue) -> {
        computeHangPoint();
    });

    startYProperty().addListener((observable, oldValue, newValue) -> {
        computeHangPoint();
    });

    endXProperty().addListener((observable, oldValue, newValue) -> {
        computeHangPoint();
    });

    endYProperty().addListener((observable, oldValue, newValue) -> {
        computeHangPoint();
    });

    // Add a context menu to the plug
    setOnMouseClicked(new ContextMenuHandler(this));

    setStrokeWidth(7.5);
    setStrokeLineCap(StrokeLineCap.ROUND);
    setFill(null);
    setColor(Color.RED);
    setEffect(new InnerShadow());
    autosize();
    addEventFilter(MouseEvent.MOUSE_DRAGGED, mouseEvent -> moveCable(mouseEvent));

}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.SQUARE);
    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    //VBox vbox = baseFill(new VBox());
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.ROUND);
    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc();
    arc.setCenterX(DEFAULT_ARC_X);
    arc.setCenterY(DEFAULT_ARC_Y);
    arc.setRadiusX(DEFAULT_ARC_RADIUS_X);
    arc.setRadiusY(DEFAULT_ARC_RADIUS_Y);
    arc.setStartAngle(DEFAULT_ARC_START_ANGLE);
    arc.setLength(DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.BUTT);

    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}