Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Difference between AWT and Swing in Java

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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 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 heavily 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 platform-independent components. 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 JavaSwing 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.
8AWT components require java.awt package Swing components requires javax.swing package
9AWT is a thin layer of code on top of the operating system.Swing is much larger swing also has very much richer functionality.
10AWT stands for Abstract windows toolkit .Swing is also called as JFC(java Foundation classes). It is part of oracle’s JFC.
11Using AWT , you have to implement a lot of things yourself .Swing has them built in.
My Personal Notes arrow_drop_up
Last Updated : 11 Dec, 2022
Like Article
Save Article
Similar Reads
Related Tutorials