當前位置: 首頁>>代碼示例>>Java>>正文


Java Path類代碼示例

本文整理匯總了Java中javafx.scene.shape.Path的典型用法代碼示例。如果您正苦於以下問題:Java Path類的具體用法?Java Path怎麽用?Java Path使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Path類屬於javafx.scene.shape包,在下文中一共展示了Path類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clearSmallPolygons

import javafx.scene.shape.Path; //導入依賴的package包/類
private void clearSmallPolygons(Path... paths){
    validPaths = new ArrayList<>();
    Point2D p0 = Point2D.ZERO;
    for (Path path : paths) {
        for (PathElement elem : path.getElements()) {
            if (elem instanceof MoveTo) {
                elements = new ArrayList<>();
                elements.add(elem);
                listPoints = new ArrayList<>();
                p0 = new Point2D(((MoveTo)elem).getX(), ((MoveTo)elem).getY());
                listPoints.add(p0);
            } else if (elem instanceof CubicCurveTo) {
                elements.add(elem);
                Point2D ini = listPoints.size() > 0 ? listPoints.get(listPoints.size() - 1) : p0;
                listPoints.addAll(evalCubicCurve((CubicCurveTo) elem, ini, POINTS_CURVE));
            } else if (elem instanceof ClosePath) {
                elements.add(elem);
                listPoints.add(p0);
                if (Math.abs(calculateArea()) > MINIMUM_AREA) {
                    validPaths.add(new Path(elements));
                }
            } 
        }
    }
}
 
開發者ID:gluonhq,項目名稱:javaone2016,代碼行數:26,代碼來源:BadgeOutline.java

示例2: Draw

import javafx.scene.shape.Path; //導入依賴的package包/類
@Override
public void Draw(Pane canvas)
{
	double height = canvas.getHeight();
	double width = canvas.getWidth();
	
	canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
	
	Path p = new Path(new PathElement[]
	{
		new MoveTo(width, 0),
		new LineTo(width, height),
		new LineTo(0, height),
		new LineTo(width, 0)
	});
	p.fillProperty().set(Colors[1]);
	p.strokeWidthProperty().set(0);
	canvas.getChildren().add(p);
}
 
開發者ID:andrewsarnold,項目名稱:FlagMaker-2,代碼行數:20,代碼來源:DivisionBendsForward.java

示例3: Draw

import javafx.scene.shape.Path; //導入依賴的package包/類
@Override
public void Draw(Pane canvas)
{
	double height = canvas.getHeight();
	double width = canvas.getWidth();
	
	canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
	
	Path p = new Path(new PathElement[]
	{
		new MoveTo(0, height),
		new LineTo(width, 0),
		new LineTo(width, height),
		new LineTo(0, 0)
	});
	p.fillProperty().set(Colors[1]);
	p.strokeWidthProperty().set(0);
	canvas.getChildren().add(p);
}
 
開發者ID:andrewsarnold,項目名稱:FlagMaker-2,代碼行數:20,代碼來源:DivisionX.java

示例4: Draw

import javafx.scene.shape.Path; //導入依賴的package包/類
@Override
public void Draw(Pane canvas)
{
	double height = canvas.getHeight();
	double width = canvas.getWidth();
	
	canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
	
	Path p = new Path(new PathElement[]
	{
		new MoveTo(width, height),
		new LineTo(0, height),
		new LineTo(0, 0),
		new LineTo(width, height)
	});
	p.fillProperty().set(Colors[1]);
	p.strokeWidthProperty().set(0);
	canvas.getChildren().add(p);
}
 
開發者ID:andrewsarnold,項目名稱:FlagMaker-2,代碼行數:20,代碼來源:DivisionBendsBackward.java

示例5: DirectedPath

import javafx.scene.shape.Path; //導入依賴的package包/類
/**
 * Constructs and binds the appropriate properties for the line and
 * the arrow
 */
public DirectedPath(DoubleBinding startX, DoubleBinding startY,
                    DoubleBinding endX,DoubleBinding endY){

    this.path = new Path();

    MoveTo start = new MoveTo();
    start.xProperty().bind(startX);
    start.yProperty().bind(startY);

    LineTo end = new LineTo();
    end.xProperty().bind(endX);
    end.yProperty().bind(endY);

    path.getElements().add(start);
    path.getElements().add(end);

    this.arrow = getArrow();

    this.getChildren().add(path);
    this.getChildren().add(arrow);

    this.path.getStyleClass().setAll("edge");
}
 
開發者ID:dmusican,項目名稱:Elegit,代碼行數:28,代碼來源:DirectedPath.java

示例6: seriesAdded

import javafx.scene.shape.Path; //導入依賴的package包/類
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:23,代碼來源:AdvCandleStickChartSample.java

示例7: createIconContent

import javafx.scene.shape.Path; //導入依賴的package包/類
public static Node createIconContent() {
    Path path = new Path();
           path.getElements().addAll(
            new MoveTo(25, 25),
            new HLineTo(45),
            new ArcTo(20, 20, 0, 80, 25, true, true)
            );
    path.setStroke(Color.web("#b9c0c5"));
    path.setStrokeWidth(5);
    path.getStrokeDashArray().addAll(15d,15d);
    path.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));
    path.setEffect(effect);
    return path;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:PathSample.java

示例8: seriesChanged

import javafx.scene.shape.Path; //導入依賴的package包/類
@Override
protected void seriesChanged(Change<? extends MultiAxisChart.Series<X, Y>> c) {
	// Update style classes for all series lines and symbols
	// Note: is there a more efficient way of doing this?
	for (int i = 0; i < getDataSize(); i++) {
		final MultiAxisChart.Series<X, Y> s = getData().get(i);
		Path seriesLine = (Path) ((Group) s.getNode()).getChildren().get(1);
		Path fillPath = (Path) ((Group) s.getNode()).getChildren().get(0);
		seriesLine.getStyleClass().setAll("chart-series-area-line", "series" + i, s.defaultColorStyleClass);
		fillPath.getStyleClass().setAll("chart-series-area-fill", "series" + i, s.defaultColorStyleClass);
		for (int j = 0; j < s.getData().size(); j++) {
			final Data<X, Y> item = s.getData().get(j);
			final Node node = item.getNode();
			if (node != null)
				node.getStyleClass().setAll("chart-area-symbol", "series" + i, "data" + j,
						s.defaultColorStyleClass);
		}
	}
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:20,代碼來源:MultiAxisAreaChart.java

示例9: updateDefaultColorIndex

import javafx.scene.shape.Path; //導入依賴的package包/類
private void updateDefaultColorIndex(final MultiAxisChart.Series<X, Y> series) {
	int clearIndex = seriesColorMap.get(series);
	Path seriesLine = (Path) ((Group) series.getNode()).getChildren().get(1);
	Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0);
	if (seriesLine != null) {
		seriesLine.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
	}
	if (fillPath != null) {
		fillPath.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
	}
	for (int j = 0; j < series.getData().size(); j++) {
		final Node node = series.getData().get(j).getNode();
		if (node != null) {
			node.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
		}
	}
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:18,代碼來源:MultiAxisAreaChart.java

示例10: bindToColor

import javafx.scene.shape.Path; //導入依賴的package包/類
public void bindToColor(final ObjectProperty<Color> color, final ObjectProperty<Color.Intensity> intensity, final boolean doColorBackground) {
    final BiConsumer<Color, Color.Intensity> recolor = (newColor, newIntensity) -> {

        final JFXTextField textField = (JFXTextField) lookup("#textField");
        textField.setUnFocusColor(TRANSPARENT);
        textField.setFocusColor(newColor.getColor(newIntensity));

        if (doColorBackground) {
            final Path shape = (Path) lookup("#shape");
            shape.setFill(newColor.getColor(newIntensity.next(-1)));
            shape.setStroke(newColor.getColor(newIntensity.next(-1).next(2)));

            textField.setStyle("-fx-prompt-text-fill: rgba(255, 255, 255, 0.6); -fx-text-fill: " + newColor.getTextColorRgbaString(newIntensity) + ";");
            textField.setFocusColor(newColor.getTextColor(newIntensity));
        } else {
            textField.setStyle("-fx-prompt-text-fill: rgba(0, 0, 0, 0.6);");
        }

    };

    color.addListener(observable -> recolor.accept(color.get(), intensity.get()));
    intensity.addListener(observable -> recolor.accept(color.get(), intensity.get()));

    recolor.accept(color.get(), intensity.get());
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:26,代碼來源:TagPresentation.java

示例11: initializeTriangle

import javafx.scene.shape.Path; //導入依賴的package包/類
private Path initializeTriangle() {
    final Path triangle = new Path();

    MoveTo start = new MoveTo();
    LineTo l1 = new LineTo();
    LineTo l2 = new LineTo();
    LineTo l3 = new LineTo();

    start.xProperty().bind(ax);
    start.yProperty().bind(ay);

    l1.xProperty().bind(bx);
    l1.yProperty().bind(by);

    l2.xProperty().bind(cx);
    l2.yProperty().bind(cy);

    l3.xProperty().bind(ax);
    l3.yProperty().bind(ay);

    triangle.setFill(Color.BLACK);
    triangle.getElements().addAll(start, l1, l2, l3);

    return triangle;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:26,代碼來源:ChannelSenderArrowHead.java

示例12: initializeHalfCircle

import javafx.scene.shape.Path; //導入依賴的package包/類
private Path initializeHalfCircle() {
    final Path halfCircle = new Path();

    halfCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(CIRCLE_RADIUS);
    p2.setRadiusY(CIRCLE_RADIUS);

    halfCircle.getElements().add(p1);
    halfCircle.getElements().add(p2);

    return halfCircle;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:HandshakeChannelSenderArrowHead.java

示例13: initializeLargeCircle

import javafx.scene.shape.Path; //導入依賴的package包/類
private Path initializeLargeCircle() {
    final Path largeCircle = new Path();

    largeCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(LARGE_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(LARGE_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(LARGE_CIRCLE_RADIUS);
    p2.setRadiusY(LARGE_CIRCLE_RADIUS);

    largeCircle.getElements().add(p1);
    largeCircle.getElements().add(p2);

    return largeCircle;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:BroadcastChannelSenderArrowHead.java

示例14: initializeMediumCircle

import javafx.scene.shape.Path; //導入依賴的package包/類
private Path initializeMediumCircle() {
    final Path mediumCircle = new Path();

    mediumCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(MEDIUM_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(MEDIUM_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(MEDIUM_CIRCLE_RADIUS);
    p2.setRadiusY(MEDIUM_CIRCLE_RADIUS);

    mediumCircle.getElements().add(p1);
    mediumCircle.getElements().add(p2);

    return mediumCircle;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:BroadcastChannelSenderArrowHead.java

示例15: initializeSmallCircle

import javafx.scene.shape.Path; //導入依賴的package包/類
private Path initializeSmallCircle() {
    final Path smallCircle = new Path();

    smallCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(SMALL_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(SMALL_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(SMALL_CIRCLE_RADIUS);
    p2.setRadiusY(SMALL_CIRCLE_RADIUS);

    smallCircle.getElements().add(p1);
    smallCircle.getElements().add(p2);

    return smallCircle;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:BroadcastChannelSenderArrowHead.java


注:本文中的javafx.scene.shape.Path類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。