Difference between AWT and Swing in Java


In Java, The Abstract Window Toolkit (AWT) package enables the programming used to create GUI-based applications. It contains several classes that help to implement common window-based tasks. such as windows, adding scroll bar, buttons, list items, text boxes, etc. All the classes are contained in the [java]java.awt[/java] package.


Swing is a GUI toolkit that facilitates the creation of highly interactive GUI applications. It is more flexible and robust when it comes to implementing graphical components.

AWT vs Swing:

1. AWT stands for Abstract Windows Toolkit1. Swing is also known as JFC (Java Foundation Classes)
2. AWT components are called Heavy-weight component2. Swing components are called light-weight component
3. AWT components require java.awt package3. Swing components require javax.swing package
4. It's components are platform dependent4. It's components are platform independent
5. It's execution is slower5. It's execution is faster
6. It doesn't support MVC Pattern.6. It supports MVC Pattern.