JavaFX Tutorial - Java Arc(double centerX, double centerY, double radiusX, double radiusY, double startAngle, double length) Constructor








Syntax

Arc(double centerX, double centerY, double radiusX, double radiusY, double startAngle, double length) constructor from Arc has the following syntax.

public Arc(double centerX,
 double centerY,
 double radiusX,
 double radiusY,
 double startAngle,
 double length)

Example

In the following code shows how to use Arc.Arc(double centerX, double centerY, double radiusX, double radiusY, double startAngle, double length) constructor.

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
import javafx.stage.Stage;
//  www.j av  a  2  s  . c  o  m
public class Main extends Application {
    public static void main(String[] args) {
        Application.launch(args);
    }
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Text Fonts");

        Group g = new Group();
        Scene scene = new Scene(g, 550, 250,Color.web("0x0000FF",1.0));

        Arc arc = new Arc(30,30,30,30,30,30);
        arc.setCenterX(50.0f);
        arc.setCenterY(50.0f);
        arc.setRadiusX(25.0f);
        arc.setRadiusY(25.0f);
        arc.setStartAngle(45.0f);
        arc.setLength(270.0f);
        arc.setType(ArcType.ROUND);
        
        g.getChildren().add(arc);
        
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}