Example usage for javafx.scene.shape Ellipse setFill

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

Introduction

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

Prototype

public final void setFill(Paint value) 

Source Link

Usage

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);
    root.getChildren().add(ellipse);//from w  w w  . ja v  a2  s  .c  o m

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