// This sample demonstrates how to rotate
    // a node programmatically at arbitrary angle

    // Create a node
    ShapeNode node = diagram.getFactory().createShapeNode(10, 10, 120, 50);

    // Set the node's shape
    node.setShape(Shape.fromId("Decision"));

    // Rotate the node now at 30 degrees
    node.setRotationAngle(30);

    // Show some text in the node and make the text rotate as well
    node.setText("Rotated box");
    node.setFont(new Font("Arial", Font.BOLD, 12));
    node.setRotateText(true);