Converting from the AWT to Swing
If you are presented with the task of creating a Swing program that replaces an existing AWT program, it's important that you first learn some Swing basics (like you will learn in the next chapter). Then, convert the AWT program to its Swing-based equivalent, and then add new capabilities and/or remove/replace existing capabilities. When you are ready to convert from the AWT to Swing, keep the following tips in mind:
Back up your code.
Remove all java.awt package/subpackage references.
Remove all java.applet package references (for applets only).
Add an import javax.swing.*; directive.
Watch out for threading problems. (Chapter 16, "Building a GUI: Swing Style," explains Swing's threading issues and discusses workarounds.) ...
Get Special Edition Using Java 2 Standard 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.