JavaFX RadialGradient create
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.RadialGradientBuilder; 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);/*from w ww.j av a 2s .c o m*/ } @Override public void start(Stage primaryStage) { primaryStage.setTitle("java2s.com"); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); Ellipse bigCircle = new Ellipse(); bigCircle.setCenterX(100); bigCircle.setCenterY(100); bigCircle.setRadiusX(50); bigCircle.setRadiusY(75 / 2); bigCircle.setStrokeWidth(3); bigCircle.setStroke(Color.BLACK); 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(); bigCircle.setFill(gradient1); root.getChildren().add(bigCircle); primaryStage.setScene(scene); primaryStage.show(); } }