Java examples for JavaFX:Shape
Creating CubicCurve Shapes
import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.CubicCurve; import javafx.scene.shape.StrokeType; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { Application.launch(args);/*from w w w.j a va 2 s . c o m*/ } @Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 306, 550, Color.WHITE); // CubicCurve CubicCurve cubicCurve = new CubicCurve(); cubicCurve.setStartX(50); cubicCurve.setStartY(75); // start pt (x1,y1) cubicCurve.setControlX1(180); cubicCurve.setControlY1(-25);// control pt1 cubicCurve.setControlX2(110); cubicCurve.setControlY2(15); // control pt2 cubicCurve.setEndX(140); cubicCurve.setEndY(75); cubicCurve.setStrokeType(StrokeType.CENTERED); cubicCurve.setStrokeWidth(1); cubicCurve.setStroke(Color.BLACK); cubicCurve.setStrokeWidth(3); cubicCurve.setFill(Color.WHITE); root.getChildren().add(cubicCurve); primaryStage.setScene(scene); primaryStage.show(); } }