Java Ellipse(double radiusX, double radiusY) Constructor

Syntax

Ellipse(double radiusX, double radiusY) constructor from Ellipse has the following syntax.

public Ellipse(double radiusX,
  double radiusY)

Example

In the following code shows how to use Ellipse.Ellipse(double radiusX, double radiusY) constructor.


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;
/* w  w  w  .j a v a2s  .  co m*/
public class Main extends Application {
    public static void main(String[] args) {
        Application.launch(args);
    }
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Shapes");
        Group root = new Group();
        Scene scene = new Scene(root, 300, 300, Color.WHITE);

        Ellipse bigCircle = new Ellipse(20,20);
        bigCircle.setCenterX(20);
        bigCircle.setCenterY(20);
        bigCircle.setRadiusX(10);
        bigCircle.setRadiusY(10);
        
        System.out.println(bigCircle.centerXProperty().doubleValue());

        root.getChildren().add(bigCircle);
        
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}




















Home »
  Java Tutorial »
    javafx.scene.shape »




Arc
ArcBuilder
Circle
Ellipse
Line
Polygon
VLineTo