1  import javafx.application.Application;
  2  import javafx.scene.Scene;
  3  import javafx.scene.Group;
  4  import javafx.scene.layout.BorderPane;
  5  import javafx.scene.paint.Color;
  6  import javafx.stage.Stage;
  7  import javafx.scene.shape.Arc;
  8  import javafx.scene.shape.ArcType;
  9  import javafx.scene.text.Text;
 10  
 11  public class ShowArc extends Application {
 12    @Override // Override the start method in the Application class
 13    public void start(Stage primaryStage) {   
 14      Arc arc1 = new Arc(150, 100, 80, 80, 30, 35); // Create an arc
 15      arc1.setFill(Color.RED); // Set fill color
 16      arc1.setType(ArcType.ROUND); // Set arc type
 17      
 18      Arc arc2 = new Arc(150, 100, 80, 80, 30 + 90, 35);
 19      arc2.setFill(Color.WHITE);
 20      arc2.setType(ArcType.OPEN);
 21      arc2.setStroke(Color.BLACK);
 22  
 23      Arc arc3 = new Arc(150, 100, 80, 80, 30 + 180, 35);
 24      arc3.setFill(Color.WHITE);
 25      arc3.setType(ArcType.CHORD);
 26      arc3.setStroke(Color.BLACK);
 27      
 28      Arc arc4 = new Arc(150, 100, 80, 80, 30 + 270, 35);
 29      arc4.setFill(Color.GREEN);
 30      arc4.setType(ArcType.CHORD);
 31      arc4.setStroke(Color.BLACK);
 32      
 33      // Create a group and add nodes to the group
 34      Group group = new Group();
 35      group.getChildren().addAll(new Text(210, 40, "arc1: round"), 
 36        arc1, new Text(20, 40, "arc2: open"), arc2,
 37        new Text(20, 170, "arc3: chord"), arc3, 
 38        new Text(210, 170, "arc4: chord"), arc4);      
 39  
 40      // Create a scene and place it in the stage
 41      Scene scene = new Scene(new BorderPane(group), 300, 200);
 42      primaryStage.setTitle("ShowArc"); // Set the stage title
 43      primaryStage.setScene(scene); // Place the scene in the stage
 44      primaryStage.show(); // Display the stage
 45    }
 46    
 47    /**
 48     * The main method is only needed for the IDE with limited
 49     * JavaFX support. Not needed for running from the command line.
 50     */
 51    public static void main(String[] args) {
 52      launch(args);
 53    }
 54  }