Create Ellipse in JavaFX - Java JavaFX

Java examples for JavaFX:Shape

Description

Create Ellipse in JavaFX

Demo Code

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 ww  w. j  a  v a2  s  .  c  o m*/
  }

  @Override
  public void start(Stage primaryStage) {
    Group root = new Group();
    Scene scene = new Scene(root, 306, 550, Color.WHITE);

    Ellipse bigCircle = new Ellipse(100, 100, 50, 75 / 2);
    bigCircle.setTranslateY(123);
    bigCircle.setStrokeWidth(3);
    bigCircle.setStroke(Color.BLACK);
    bigCircle.setFill(Color.WHITE);

    root.getChildren().add(bigCircle);

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

Related Tutorials