Difference between AWT and Swing in Java

Java is one of the most in-demand programming languages for developing a variety of applications. The popularity of Java can be attributed to its versatility as it can be used to design customized applications that are light and fast and serve a variety of purposes ranging from web services to android applications. Java is fast, reliable and secure. There are multiple ways to develop GUI based applications in java, out of which the most popular ones are AWT and Swing.

Before getting into the differences, let us first understand what each of them actually is.

1. AWT 
AWT stands for Abstract Window Toolkit. It is a platform-dependent API to develop GUI (Graphical User Interface) or window-based applications in Java. It was developed by Sun Microsystems In 1995. It is heavy-weight in use because it is generated by the system’s host operating system. It contains a large number of classes and methods, which are used for creating and managing GUI. 

2. Swing: 
Swing is a lightweight Java graphical user interface (GUI) that is used to create various applications. Swing has components which are platform-independent. It enables the user to create buttons and scroll bars. Swing includes packages for creating desktop applications in Java. Swing components are written in Java language. It is a part of Java Foundation Classes(JFC). 

Difference between AWT and Swing: 
 



S.NO

AWT

Swing

1. Java AWT is an API to develop GUI applications in Java Swing is a part of Java Foundation Classes and is used to create various applications.
2. The components of Java AWT are heavy weighted. The components of Java Swing are light weighted.
3. Java AWT has comparatively less functionality as compared to Swing. Java Swing has more functionality as compared to AWT.
4. The execution time of AWT is more than Swing. The execution time of Swing is less than AWT.
5. The components of Java AWT are platform dependent. The components of Java Swing are platform independent.
6. MVC pattern is not supported by AWT. MVC pattern is supported by Swing.
7. AWT provides comparatively less powerful components. Swing provides more powerful components.

 

Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : pareshchawla56

Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.