JavaFX Polygon create
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; import javafx.scene.shape.Polygon; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { Application.launch(args);//from w ww. jav a2s . co m } @Override public void start(Stage stage) { // Create a parallelogram Polygon parallelogram = new Polygon(); parallelogram.getPoints().addAll(30.0, 0.0, 130.0, 0.0, 100.00, 50.0, 0.0, 50.0); parallelogram.setFill(Color.AZURE); parallelogram.setStroke(Color.BLACK); // Add all shapes to an HBox HBox root = new HBox(parallelogram); root.setSpacing(10); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("2D Shapes"); stage.show(); } }