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

Lightweights and Their Graphics

Invoking getGraphics() on a lightweight component returns a copy of the Graphics for the lightweight's heavyweight container. Since lightweights are rendered in their (heavyweight) container's window, they have no Graphics of their own.

Figure 19-5 shows an applet with a simple heavyweight component.

Figure 19-5. A Simple Heavyweight Component

The applet is listed in Example 19-7.

Example 19-7. A Heavyweight Component
 import java.applet.Applet; import java.awt.*; public class TestApplet extends Applet { public void ...

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