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

Summary

Lightweight components, unlike their heavyweight counterparts, do not require a native, opaque window in which to render themselves and, therefore, have transparent backgrounds. As a result, lightweight components can appear to be nonrectangular, although their bounding boxes are in fact rectangular.

Lightweight components are extremely simple to implement; they merely need to extend java.awt.Component (for lightweight components) or java.awt.Container (for lightweight containers).

There are a couple of pitfalls to be aware of when developing lightweight components and lightweight containers. First, custom containers that contain lightweight components and override paint() must be sure to invoke super.paint(), or the lightweight components ...

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