Introducing Lightweight Components

Developing custom components versions of the AWT prior to 1.1 typically involved extending either java.awt.Canvas or java.awt.Panel—the latter was extended when a custom component had to function as a container.

Lightweight custom components are implemented simply by extending either java.awt.Component or java.awt.Container. With previous versions of the AWT, Component and Container could only be extended only by classes residing in the java.awt package, because their constructors had package scope. This restriction has been removed as of the 1.1 AWT—classes outside of the java.awt package may now extend either Component or Container.

The AWT: A Heavyweight World

In principle, creating a lightweight component ...

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.