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