JavaFX Tutorial - Java Circle(double centerX, double centerY, double radius, Paint fill) Constructor








Syntax

Circle(double centerX, double centerY, double radius, Paint fill) constructor from Circle has the following syntax.

public Circle(double centerX,
  double centerY,
  double radius,
  Paint fill)

Example

In the following code shows how to use Circle.Circle(double centerX, double centerY, double radius, Paint fill) constructor.

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
//ww  w  . j  a v  a  2  s. co m
public class Main extends Application {

    public static void main(String[] args) {
        Application.launch(args);
    }
    
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Title");
        
        final Circle circ = new Circle(40,30,20,Color.RED);
        final Group root = new Group(circ);
        final Scene scene = new Scene(root, 400, 300);        
              
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}