This upper-level Graphics class offers the most basic drawing resources. It represents an early attempt (Java 1.0) to offer graphical opportunities to programmers. The inclusion of this discussion in our course is primarily for the appreciation of the historical evolution of graphics programming in Java. The Graphics class remains within the Java language primarily for legacy purposes but should avoided in favour of the Graphics2D (its Java2D subclass) and Swing.
The text below has been taken from the javadoc of the Graphics class.
The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images.
A Graphics object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties:
Coordinates are infinitely thin and lie between the pixels of the output device. Operations that draw the outline of a figure operate by traversing an infinitely thin path between pixels with a pixel-sized pen that hangs down and to the right of the anchor point on the path. Operations that fill a figure operate by filling the interior of that infinitely thin path. Operations that render horizontal text render the ascending portion of character glyphs entirely above the baseline coordinate.
The graphics pen hangs down and to the right from the path it traverses. This has the following implications: