Example usage for javafx.scene.shape Line Line

List of usage examples for javafx.scene.shape Line Line

Introduction

In this page you can find the example usage for javafx.scene.shape Line Line.

Prototype

public Line() 

Source Link

Document

Creates an empty instance of Line.

Usage

From source file:Main.java

public static void addMarker(final XYChart<?, ?> chart, final StackPane chartWrap) {
    final Line valueMarker = new Line();
    final Node chartArea = chart.lookup(".chart-plot-background");

    chartArea.setOnMouseMoved(new EventHandler<MouseEvent>() {
        @Override//from  www.  j  a  va  2 s . c o  m
        public void handle(MouseEvent event) {
            Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY());
            Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY());

            Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal());
            valueMarker.setStartY(0);
            valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY()
                    - chartWrap.sceneToLocal(chartAreaBounds).getMinY());

            valueMarker.setStartX(0);
            valueMarker.setEndX(0);
            valueMarker.setTranslateX(position.getX() - chartWrap.getWidth() / 2);

            double ydelta = chartArea.localToScene(0, 0).getY() - chartWrap.localToScene(0, 0).getY();
            valueMarker.setTranslateY(-ydelta * 2);
        }
    });

    chartWrap.getChildren().add(valueMarker);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*from   w w w.  j  a  va 2 s .c o m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);//from   w  ww  . ja v  a 2 s.  c  o m

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.getStartY());

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);//from www.j a v  a2 s. c o m

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    line.setEndY(0.4);

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*from  w  ww.j a  v  a 2  s. c  o  m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.getStartX());

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/* w w w. j  a  v  a  2 s  .  c  om*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    line.setStartX(0.4);

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/* ww  w  .j a  v a2s.  co m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    line.setEndX(0.4);

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*w w  w .j  a v  a2 s.  co  m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.startYProperty());

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*from www.ja v  a  2 s.  co  m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.getEndX());

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);/*  ww  w.  j a  v a 2s. c  o m*/

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.getEndY());

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}