Mixing Heavyweight and Lightweight Components
In Chapter 14, "Building a GUI: AWT Style," you learned that it's not a good idea to mix AWT heavyweight components with lightweight Swing components. Now, you're going to see what happens when this advice is ignored. To demonstrate what can go wrong, several Swing programs will be presented. Don't be concerned about not understanding their collective source code. After you've read the next chapter, come back and study this code. You'll find that it makes more sense.
The first program—MixedDemo1—demonstrates what happens when a lightweight label is placed into the same container as a heavyweight label. The result is shown in Figure 15.3 and source code is presented in Listing 15.4.