A Note About Mixing Swing and AWT Components

Swing components are lightweight. AWT components, now out of fashion, are heavyweight. That means that it is a bad idea to mix the older AWT components with Swing components. The reason is that you will get unpredictable behavior. More specifically, you will find that the AWT components will always force themselves in front of the sweet little lightweight Swing components. You could have serious trouble displaying a Canvas, for example, in tandem with a JPanel. Just something to beware of.

The designers of the Swing libraries learned a lot from working with AWT, and you should be able to find the components you need in the newer libraries without having to mix.

Disclaimer: The most popular book on ...

Get Java Garage 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.