Example usage for javafx.scene.shape Ellipse Ellipse

List of usage examples for javafx.scene.shape Ellipse Ellipse

Introduction

In this page you can find the example usage for javafx.scene.shape Ellipse Ellipse.

Prototype

public Ellipse(double centerX, double centerY, double radiusX, double radiusY) 

Source Link

Document

Creates an instance of Ellipse of the given position and size.

Usage

From source file:Main.java

@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, 30, 30);
    bigCircle.setCenterX(20);/*w  ww  .  j  a v  a  2  s .  c om*/
    bigCircle.setCenterY(20);
    bigCircle.setRadiusX(10);
    bigCircle.setRadiusY(10);

    System.out.println(bigCircle.centerXProperty().doubleValue());

    root.getChildren().add(bigCircle);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Colors");
    Group root = new Group();
    Scene scene = new Scene(root, 350, 300, Color.WHITE);

    Ellipse ellipse = new Ellipse(100, 50 + 70 / 2, 50, 70 / 2);
    RadialGradient gradient1 = RadialGradientBuilder.create().focusAngle(0).focusDistance(.1).centerX(80)
            .centerY(45).radius(120).proportional(false).cycleMethod(CycleMethod.NO_CYCLE)
            .stops(new Stop(0, Color.RED), new Stop(1, Color.BLACK)).build();

    ellipse.setFill(gradient1);/*from  w ww . j  a v a2s  . c o m*/
    root.getChildren().add(ellipse);

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