本文整理匯總了Java中javafx.scene.shape.StrokeLineCap類的典型用法代碼示例。如果您正苦於以下問題:Java StrokeLineCap類的具體用法?Java StrokeLineCap怎麽用?Java StrokeLineCap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StrokeLineCap類屬於javafx.scene.shape包,在下文中一共展示了StrokeLineCap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawSelection
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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);
}
示例2: drawSelection
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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);
}
示例3: initGraphics
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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);
}
示例4: initGraphics
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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);
}
示例5: initGraphics
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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);
}
示例6: createStartingCurve
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
/**
* 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;
}
示例7: drawGradientBar
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}
示例8: drawNode
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
@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;
}
示例9: drawGradientBar
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}
示例10: drawHours
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}
}
示例11: drawMinutes
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}
}
示例12: drawSeconds
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}
}
示例13: drawGradientBar
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}
示例14: drawGradientBar
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}
示例15: drawGradientBar
import javafx.scene.shape.StrokeLineCap; //導入依賴的package包/類
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();
}