1  import javafx.application.Application;
  2  import javafx.scene.Scene;
  3  import javafx.scene.layout.Pane;
  4  import javafx.scene.paint.Color;
  5  import javafx.stage.Stage;
  6  import javafx.scene.shape.Line;
  7  
  8  public class ShowLine extends Application {
  9    @Override // Override the start method in the Application class
 10    public void start(Stage primaryStage) {   
 11      // Create a scene and place it in the stage
 12      Scene scene = new Scene(new LinePane(), 200, 200);
 13      primaryStage.setTitle("ShowLine"); // Set the stage title
 14      primaryStage.setScene(scene); // Place the scene in the stage
 15      primaryStage.show(); // Display the stage
 16    }
 17  }
 18  
 19  class LinePane extends Pane {
 20    public LinePane() {
 21      Line line1 = new Line(10, 10, 10, 10);
 22      line1.endXProperty().bind(widthProperty().subtract(10));
 23      line1.endYProperty().bind(heightProperty().subtract(10));
 24      line1.setStrokeWidth(5);
 25      line1.setStroke(Color.GREEN);
 26      getChildren().add(line1);
 27      
 28      Line line2 = new Line(10, 10, 10, 10);
 29      line2.startXProperty().bind(widthProperty().subtract(10));
 30      line2.endYProperty().bind(heightProperty().subtract(10));
 31      line2.setStrokeWidth(5);
 32      line2.setStroke(Color.GREEN);
 33      getChildren().add(line2);
 34    }
 35  }