Unless specified otherwise, the origin of a Graphics' coordinate system coincides with the upper left-hand corner of its associated component, image or print job, as illustrated in “The Graphics Coordinate System”.
Graphics.translate() can be used to translate the origin to a new location. The translate method is passed two integer values representing a point in the original coordinate system that will become the origin of the translated coordinate system.
Translating a coordinate system's origin is done for numerous reasons; one reason is to scroll the contents of a container without scrollbars, as our next applet illustrates.
The applet shown in Figure 3-12 displays an image that can be scrolled by dragging ...