Main Differences between Swing and AWT
Swing comonents are light-weight as compared to AWT components for the simple reason that they don’t make use of the native UI components of the underlying platform.
Swing components haven been written completely in Java language. Not the same with AWT as it uses native libraries.
Swing components use relatively less number of classes as compared to AWT components not only because the it doesn’t depend on native code, but also because it has a better design due to its evolution from AWT. Most of the design flaws got fixed which ultimately led to lesser redundancies.
The look and feel of the Swing components is defined only by the Swing extension classes and it’s pluggable to have the look and feel of the underlying platform as well whereas the look and feel of the AWT comonents is mostly goverened by the underlying platform. By default, Swing components open up in their own look and feel.
Swing extension is completely based on the MVC (Model View Controller) architecture and hence the inherent benefits of the MVC design pattern add more value to the usage of Swing.
In addition there are few other trivial differences as well. For example: Swing extension has a richer set of components as compared to AWT, Swing’s JPanel automatically gets double buffered and gets repainted faster, etc.
When to use what?
Due to all these advantages, Swing has almost entirely relaced AWT and you got to have a really strong reason if you are still using AWT in your application which is very hard to find at least for platform-independent applications.