Graphics References

There are two ways to obtain a reference to a component's Graphics: override one of the methods listed in Table 3-1 that are passed a Graphics reference or invoke one of the methods listed in Table 3-2, all of which return a Graphics reference.

It is worth mentioning that the Graphics reference returned from getGraphics() in Component, Image, and PrintJob does not, as the name might seem to imply, return a reference to a single Graphics reference. Instead, the methods return a copy of the original Graphics. As we'll see in the next section, this has some important consequences.

Graphics References Refer to Copies

It is important to emphasize that Graphics references refer to copies of the actual Graphics associated with a ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.