Java 2D contains the AffineTransform
class, which makes it easy to use a matrix to specify a transformation on the Cartesian Plane. It's also easy to apply this transform to your Graphics2D
object through its setTransform
method.
You can use a standard transform to apply your own coordinate system onto screen coordinates. Then you can manipulate this transform to account for panning and zooming. This will allow you to use your own coordinate system for laying out your content while completely abstracting away all of the panning and zooming functionality into one place.