O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required