import java.awt.*; import java.awt.geom.AffineTransform; public class Transform4 extends Canvas{ public void paint(Graphics alggr){ Graphics2D g=(Graphics2D)alggr; g.setTransform(AffineTransform.getRotateInstance(Math.PI/4, 100, 75)); g.fillRect(20, 20, 40, 20); } }