Example usage for javafx.scene.shape Rectangle getTransforms

List of usage examples for javafx.scene.shape Rectangle getTransforms

Introduction

In this page you can find the example usage for javafx.scene.shape Rectangle getTransforms.

Prototype

public final ObservableList<Transform> getTransforms() 

Source Link

Document

Defines the ObservableList of javafx.scene.transform.Transform objects to be applied to this Node .

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Sample");
    stage.setWidth(300);//from  w  w  w . j a  va  2  s.c  om
    stage.setHeight(190);

    VBox vbox = new VBox();
    vbox.setLayoutX(20);
    vbox.setLayoutY(20);

    Rectangle rect = new Rectangle(50, 50, Color.RED);
    rect.getTransforms().add(new Rotate(45, 0, 0)); //

    vbox.getChildren().add(rect);
    vbox.setSpacing(10);
    ((Group) scene.getRoot()).getChildren().add(vbox);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");

    Group rectangleGroup = new Group();
    Scene scene = new Scene(rectangleGroup, 550, 250);

    Rectangle rect = new Rectangle();
    rect.setWidth(100);//w  ww.  j a v a 2 s.c o  m
    rect.setHeight(100);

    Shear sh = new Shear();
    sh.setY(0.4);
    rect.getTransforms().add(sh);

    rectangleGroup.getChildren().add(rect);

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Rectangle rect1 = new Rectangle(100, 50, Color.LIGHTGRAY);
    rect1.setStroke(Color.BLACK);

    Rectangle rect2 = new Rectangle(100, 50, Color.YELLOW);
    rect2.setStroke(Color.BLACK);

    Translate translate = new Translate(50, 10);
    Rotate rotate = new Rotate(30, 0, 0);
    Scale scale = new Scale(0.5, 0.5);
    Shear shear = new Shear(0.5, 0.5);
    rect2.getTransforms().addAll(translate, rotate, scale, shear);

    Pane root = new Pane(rect1, rect2);
    root.setPrefSize(200, 100);/* w  ww  . j  a v a 2  s  . c  om*/
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("");
    stage.show();
}