import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
public class AffineTransformGetRotateInstance extends Frame {
public static void main(String[] args) {
(new AffineTransformGetRotateInstance()).setVisible(true);
}
public AffineTransformGetRotateInstance() {
setSize(350, 300);
}
public void paint(Graphics g) {
AffineTransform atrans = null;
Graphics2D g2d = (Graphics2D) g;
atrans = AffineTransform.getRotateInstance(Math.PI / 4, 50, 50);
if (atrans != null)
g2d.setTransform(atrans);
g2d.fillRect(50, 50, 100, 50);
}
}