JavaFX RadialGradient create using constructor
import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.paint.CycleMethod; import javafx.scene.paint.RadialGradient; import javafx.scene.paint.Stop; import javafx.scene.shape.Ellipse; import javafx.stage.Stage; public class Main extends Application{ public static void main(String[] args) { Application.launch(args);/* www .j a v a 2s .co m*/ } @Override public void start(Stage primaryStage) { primaryStage.setTitle("java2s.com"); 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 = new RadialGradient(0, .1, // focus angle 80, // focus distance 45, // centerX 120, // centerY false, // proportional CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(1, Color.BLACK)); ellipse.setFill(gradient1); root.getChildren().add(ellipse); primaryStage.setScene(scene); primaryStage.show(); } }