AWT stands for Abstract Window Toolkit. It is responsible for handling all the user-interface and graphics tools. It is the part of the JFC (Java Foundation Class), which is the standardized API for Graphical user-interface for any program. AWT ensures that your program will be well interpreted by the user.
Swing is the advanced and modern toolkit for Java. It is also a part of the JFC (Java Foundation Class). It has more personalized and sophisticated features over the earlier Abstract Window Toolkit (AWT). It emulates a better look and feels for your program.
Comparison between AWT and SWING:
- AWT components are also referred to as Heavyweight components, whereas; the swing components are also known as Lightweight components.
- AWT components work on java.awt package, whereas; the swing component works on javax.swing package.
- AWT components are very platform sensitive, whereas; the swing components are platform independent.
- The swing components provide a great look and feel for the program, whereas; AWT does not support this feature.
- Swing has many advanced features which are not available in AWT like JButton, JDialog, JTextArea, etc. Its components are not native to any Operating System, which in turn provides swing components with those lightweight features.
- AWT is a very fine layer of code that lies over the operating system, whereas; the swing is quite larger as it is well defined and is not OS dependent.
- AWT has no richer functionality because of its dependent code, whereas; the swing has very rich functionality because of its well-defined structure.
- While working with AWT you have to implement many things on your own, whereas; while working with Swing all the functionalities are already built-in.
- AWT components being Heavyweight takes a longer time to load, whereas; the swing components being Lightweight loads up very quickly.
- AWT does not follow MVC (Modern View Control), whereas; the swing follows MVC.
- AWT has a lesser number of well-defined components, whereas; the swing has a higher number of well-defined components.
- AWT has an old and unappealing graphical user interface (GUI), whereas; the swing has modernized and illustrative graphical user interface (GUI).
- AWT components require a large amount of memory space, whereas; the swing components does not require any memory space.