import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.scene.shape.Line; import javafx.scene.paint.Color; public class ShowLine extends Application { @Override public void start(Stage primaryStage) { Pane pane = new Pane(); 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); Line line2 = new Line(10, 10, 10, 10); line2.startXProperty().bind(pane.widthProperty().subtract(10)); line2.endYProperty().bind(pane.heightProperty().subtract(10)); line2.setStrokeWidth(5); line2.setStroke(Color.GREEN); pane.getChildren().add(line2); Scene scene = new Scene(pane, 200, 200); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }