JavaFX Ellipse create and set property

Description

JavaFX Ellipse create and set property

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Ellipse;
import javafx.stage.Stage;

public class Main extends Application {

    public static void main(String[] args) {
        Application.launch(args);//from   w  w  w .  j  a  v  a 2 s  .  c om
    }
    
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("java2s.com");
        Group root = new Group();
        Scene scene = new Scene(root, 300, 250, Color.WHITE);

        Ellipse bigCircle = new Ellipse();
        bigCircle.setCenterX(100);
        bigCircle.setCenterY(100);
        bigCircle.setRadiusX(50);
        bigCircle.setRadiusY(75/2);
        
        bigCircle.setStrokeWidth(3);
        bigCircle.setStroke(Color.BLACK);
        bigCircle.setFill(Color.WHITE);

        root.getChildren().add(bigCircle);

        primaryStage.setScene(scene);
        
        primaryStage.show();
    }
}



PreviousNext

Related