Using QuadCurve, set the control Point and Stroke, fill : QuadCurve « JavaFX « Java






Using QuadCurve, set the control Point and Stroke, fill

 

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.effect.DropShadow;
import javafx.scene.effect.DropShadowBuilder;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import javafx.stage.Stage;
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);

        Path path = new Path();

        QuadCurve quad =QuadCurveBuilder.create()
                .startX(50)
                .startY(50)
                .endX(150)
                .endY(50)
                .controlX(125)
                .controlY(150)
                .translateY(path.getBoundsInParent().getMaxY())
                .strokeWidth(3)
                .stroke(Color.BLACK)
                .fill(Color.WHITE)
                .build();

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

   
  








Related examples in the same category

1.quadratic BĂ©zier parametric curve segment