Example usage for javafx.scene.shape Line endXProperty

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

Introduction

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

Prototype

public final DoubleProperty endXProperty() 

Source Link

Usage

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  va  2s  . 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.endXProperty());

    box.getChildren().add(line);

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

From source file:Main.java

private Line connect(Circle c1, Circle c2) {
    Line line = new Line();

    line.startXProperty().bind(c1.centerXProperty());
    line.startYProperty().bind(c1.centerYProperty());

    line.endXProperty().bind(c2.centerXProperty());
    line.endYProperty().bind(c2.centerYProperty());

    line.setStrokeWidth(1);//from  w w w.  j a va 2s  .c  o  m
    line.setStrokeLineCap(StrokeLineCap.BUTT);
    line.getStrokeDashArray().setAll(1.0, 4.0);

    return line;
}

From source file:edu.kit.trufflehog.view.jung.visualization.FXVisualizationViewer.java

public FXVisualizationViewer(INetworkViewPort port) {

    this.port = port;
    // create canvas
    this.setStyle("-fx-background-color: #213245");

    for (double divide = .25; divide < 1; divide += .25) {
        final Line line = new Line(0, 200, this.getWidth(), this.getHeight());
        line.setFill(null);//www.j  a v a 2s .co m
        line.setStroke(Color.web("0x385172"));
        line.setStrokeWidth(1.3);
        line.getStrokeDashArray().addAll(5d, 10d);

        line.startYProperty().bind(this.heightProperty().multiply(divide));

        line.endXProperty().bind(this.widthProperty());
        line.endYProperty().bind(this.heightProperty().multiply(divide));

        this.getChildren().add(line);
    }

    for (double divide = .25; divide < 1; divide += .25) {
        final Line line = new Line(0, 0, this.getWidth(), this.getHeight());
        line.setFill(null);
        line.setStroke(Color.web("0x385172"));
        line.setStrokeWidth(1.3);
        line.getStrokeDashArray().addAll(5d, 10d);

        line.startXProperty().bind(this.widthProperty().multiply(divide));

        line.endXProperty().bind(this.widthProperty().multiply(divide));
        line.endYProperty().bind(this.heightProperty());

        this.getChildren().add(line);
    }

    //StackPane spane = new StackPane();
    //spane.setBackground(new Background(new BackgroundFill(Color.BEIGE, null, null)));

    Pane ghost = new Pane();
    canvas = new PannableCanvas(ghost);

    Pane parent = new Pane();
    parent.getChildren().add(ghost);
    parent.getChildren().add(canvas);

    SceneGestures sceneGestures = new SceneGestures(parent, canvas);

    addEventFilter(MouseEvent.MOUSE_PRESSED, sceneGestures.getOnMousePressedEventHandler());
    addEventFilter(MouseEvent.MOUSE_DRAGGED, sceneGestures.getOnMouseDraggedEventHandler());
    addEventFilter(ScrollEvent.ANY, sceneGestures.getOnScrollEventHandler());

    new RubberBandSelection(this);

    // TODO make canvas transparent
    //canvas.setStyle("-fx-background-color: #1d1d1d");

    // we don't want the canvas on the top/left in this example => just
    // translate it a bit
    //canvas.setTranslateX(100);
    //canvas.setTranslateY(100);

    // create sample nodes which can be dragged
    nodeGestures = new NodeGestures();
    //this.getChildren().add(spane);
    this.getChildren().add(parent);

    this.layout = port.getDelegate();

    //this.layout.getGraph().getVertices().forEach(v -> Platform.runLater(() -> this.initVertex(v)));
    //this.layout.getGraph().getEdges().forEach(e -> Platform.runLater(() -> this.initEdge(e)));

    this.layout.getObservableGraph().addGraphEventListener(e -> {

        //Platform.runLater(() -> {

        switch (e.getType()) {
        case VERTEX_ADDED:
            final INode node = ((GraphEvent.Vertex<INode, IConnection>) e).getVertex();
            Platform.runLater(() -> initVertex(node));
            break;

        case EDGE_ADDED:
            final IConnection edge = ((GraphEvent.Edge<INode, IConnection>) e).getEdge();
            Platform.runLater(() -> initEdge(edge));
            break;

        case VERTEX_CHANGED:
            break;

        case EDGE_CHANGED:
            final IConnection changedEdge = ((GraphEvent.Edge<INode, IConnection>) e).getEdge();
            Platform.runLater(() -> changedEdge.getComponent(ViewComponent.class).getRenderer().animate());
            break;
        }
        //});
    });

}

From source file:snpviewer.SnpViewer.java

private void clearSplitPanes() {
    for (Iterator it = chromSplitPane.getItems().iterator(); it.hasNext();) {
        Object child = it.next();
        if (child instanceof Pane) {
            Pane p = (Pane) child;/*w  w w .  j  av  a 2 s. c  om*/
            for (Iterator pit = p.getChildren().iterator(); pit.hasNext();) {
                Object pChild = pit.next();
                if (pChild instanceof ImageView) {
                    ImageView i = (ImageView) pChild;
                    i.fitHeightProperty().unbind();
                    i.fitWidthProperty().unbind();
                } else if (pChild instanceof Line) {
                    Line l = (Line) pChild;
                    l.startXProperty().unbind();
                    l.endXProperty().unbind();
                    l.startYProperty().unbind();
                    l.endYProperty().unbind();
                }
            }
            p.minWidthProperty().unbind();
            p.minHeightProperty().unbind();
        }
    }
    for (Iterator it = labelSplitPane.getItems().iterator(); it.hasNext();) {
        Object child = it.next();
        if (child instanceof Pane) {
            Pane p = (Pane) child;
            p.minWidthProperty().unbind();
            p.minHeightProperty().unbind();
        }
    }
    chromSplitPane.getItems().clear();
    labelSplitPane.getItems().clear();
}