JavaFX Line bind property to its container pane
import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Line; import javafx.stage.Stage; public class Main extends Application { @Override/*from w ww . ja v a2s . c om*/ public void start(Stage primaryStage) { // Create a pane to hold the image views Pane pane = new HBox(10); pane.setPadding(new Insets(5, 5, 5, 5)); Line line1 = new Line(10, 10, 10, 10); line1.endXProperty().bind(pane.widthProperty().subtract(10)); line1.endYProperty().bind(pane.heightProperty().subtract(10)); line1.setStrokeWidth(5); line1.setStroke(Color.GREEN); pane.getChildren().add(line1); Scene scene = new Scene(pane); primaryStage.setTitle("java2s.com"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }