Example usage for java.awt.geom AffineTransform setToRotation

List of usage examples for java.awt.geom AffineTransform setToRotation

Introduction

In this page you can find the example usage for java.awt.geom AffineTransform setToRotation.

Prototype

public void setToRotation(double vecx, double vecy) 

Source Link

Document

Sets this transform to a rotation transformation that rotates coordinates according to a rotation vector.

Usage

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToRotation(Math.PI / 6, Math.PI / 6);
    at.translate(100, 0);/*w ww.j  a  va2s. c  o m*/

    g2.setTransform(at);
    g2.draw(shape);

}