build JavaFX Line Horizontal - Java javafx.scene.shape

Java examples for javafx.scene.shape:Line

Description

build JavaFX Line Horizontal

Demo Code


//package com.java2s;

import javafx.scene.shape.Line;

public class Main {
    public static void main(String[] argv) throws Exception {
        double sx = 2.45678;
        double ex = 2.45678;
        double y = 2.45678;
        System.out.println(buildLineHor(sx, ex, y));
    }//www .  j a v a 2 s  .  c o m

    /**
     *
     * @param sx
     * @param ex
     * @param y
     * @return
     */
    public static Line buildLineHor(double sx, double ex, double y) {
        return buildLine(sx, y, ex, y);
    }

    /**
     *
     * @param sx
     * @param sy
     * @param ex
     * @param ey
     * @return
     */
    public static Line buildLine(double sx, double sy, double ex, double ey) {
        Line line = new Line();
        line.setStartX(sx);
        line.setStartY(sy);
        line.setEndX(ex);
        line.setEndY(ey);
        return line;
    }
}

Related Tutorials