JavaFX add Line To Path - Java javafx.scene.shape

Java examples for javafx.scene.shape:Path

Description

JavaFX add Line To Path

Demo Code


import java.util.ArrayList;
import java.util.List;
import javafx.scene.shape.ArcTo;
import javafx.scene.shape.ClosePath;
import javafx.scene.shape.HLineTo;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.shape.PathElement;
import javafx.scene.shape.QuadCurveTo;
import javafx.scene.shape.Shape;
import javafx.scene.shape.VLineTo;
import javafx.scene.transform.Affine;

public class Main{

    /**/*from  w  w  w .  j av  a2s .c  om*/
     * @param pathSegment
     * @param x
     * @param y
     */
    public static void addLineTo(List<PathElement> pathSegment, double x,
            double y) {
        pathSegment.add(buildLineTo(x, y));
    }
    /**
     *
     * @param x
     * @param y
     * @return
     */
    public static LineTo buildLineTo(double x, double y) {
        LineTo lineTo = new LineTo();
        lineTo.setX(x);
        lineTo.setY(y);
        return lineTo;
    }
}

Related Tutorials