Whenever I read about Swing they say they are light weight components. So I just googled Swing and found that it means Swing does not depend on native peers. Is that why they are called ‘light weight’? I mean by light weight I thought maybe the Swing components occupy less memory than the AWT components. Isn’t that so?
Share
Swing is considered lightweight because it is fully implemented in Java, without calling the native operating system for drawing the graphical user interface components.
On the other hand, AWT (Abstract Window Toolkit) is heavyweight toolkit, as it merely makes calls to the operating system in order to produce its GUI components.
The Evolution of the Swing Paint System section from the Painting in AWT and Swing article explains the difference between lightweight and heavyweight:
As Swing is implemented in Java, it does have some performance disadvantage, however, I hear that performance has improved in recent releases of Java.
The advantage of Swing is that it has many more components available such as
JTableandJListwhich are more graphical and extensible than the components provided in AWT, allowing for more graphics-rich applications to be developed.