You can modify the transform attribute in the Graphics2D context to move, rotate, scale, and shear graphics primitives
when they are rendered. The transform attribute is defined by an instance of the
AffineTransform
class.
An affine transform is a transformation such as translate, rotate, scale, or shear in which parallel lines remain parallel even after being transformed.
The Graphics2D
class provides several methods for changing the transform attribute.
AffineTransform
AffineTransform
.
This code was modified from the tutorial in the reference.
Download code from transform.zip
Java Tutorial Transforming Shapes, Text, and Images
Maintained by John Loomis, last updated 30 January 2019