Canvases and Panels

The aptly named canvas provides a surface upon which you can perform graphical operations. A panel is essentially the same as a canvas, except that a panel, unlike a canvas, is also a container that can contain other components. Neither Canvas nor Panel, by default, is interested in accepting keyboard focus, and therefore do not fire key or focus events.

Until the advent of lightweight components in the 1.1 release of the AWT, Canvas and Panel were the components of choice to extend when developing custom components.[6] For custom components that did not contain other components, such as an image button, Canvas was the logical choice for the component's superclass. On the other hand, a custom component that needed to contain ...

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.