import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.transform.Rotate; import javafx.stage.Stage; publicclassRotationExampleextendsApplication { @Override publicvoidstart(Stage stage) { //Drawing Rectangle1 Rectanglerectangle1=newRectangle(150, 75, 200, 150); rectangle1.setFill(Color.BLUE); rectangle1.setStroke(Color.BLACK); //Drawing Rectangle2 Rectanglerectangle2=newRectangle(150, 75, 200, 150); //Setting the color of the rectangle rectangle2.setFill(Color.BURLYWOOD); //Setting the stroke color of the rectangle rectangle2.setStroke(Color.BLACK); //creating the rotation transformation Rotaterotate=newRotate(); //Setting the angle for the rotation rotate.setAngle(20); //Setting pivot points for the rotation rotate.setPivotX(150); rotate.setPivotY(225); //Adding the transformation to rectangle2 rectangle2.getTransforms().addAll(rotate); //Creating a Group object Grouproot=newGroup(rectangle1, rectangle2); //Creating a scene object Scenescene=newScene(root, 600, 300); //Setting title to the Stage stage.setTitle("Rotation transformation example"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); } publicstaticvoidmain(String args[]){ launch(args); } }