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.scene.shape.*;
  6  import javafx.stage.Stage;
  7  
  8  public class PathDemo extends Application {
  9    @Override // Override the start method in the Application class
 10    public void start(Stage primaryStage) {
 11      Pane pane = new Pane();
 12      
 13      // Create a Path
 14      Path path = new Path();
 15      path.getElements().add(new MoveTo(50.0, 50.0)); 
 16      path.getElements().add(new HLineTo(150.5)); 
 17      path.getElements().add(new VLineTo(100.5));
 18      path.getElements().add(new LineTo(200.5, 150.5));
 19      
 20      ArcTo arcTo = new ArcTo(45, 45, 0, 250, 100.5, 
 21        false, true);
 22      path.getElements().add(arcTo);
 23  
 24      path.getElements().add(new QuadCurveTo(50, 50, 350, 100));
 25      path.getElements().add(
 26        new CubicCurveTo(250, 100, 350, 250, 450, 10));
 27      
 28      path.getElements().add(new ClosePath());
 29      
 30      pane.getChildren().add(path);
 31      path.setFill(null);
 32      Scene scene = new Scene(pane, 300, 250);           
 33      primaryStage.setTitle("PathDemo"); // Set the window title
 34      primaryStage.setScene(scene); // Place the scene in the window
 35      primaryStage.show(); // Display the window
 36    }
 37  
 38    // Launch the program from command-line
 39    public static void main(String[] args) {
 40      launch(args);
 41    }
 42  }