Difference Between AWT and Swing (With Table)

Java is one of the most popular languages among software engineers. This language gets used for developing various software applications for phones as well as for computers. AWT and Swing are the most famous ways to develop applications in Java. 

AWT vs Swing

The main difference between AWT and Swing is that AWT is the APT (Application Programming Interface), which gets used for developing window-based applications or Graphical User Interface applications in Java. On the other hand, Swing is a Java Graphical User Interface used for creating various programmes. 

Difference Between AWT and Swing

AWT or Abstract Window Toolkit contains various methods, and classes using which GUI (Graphical User Interface) can get created and managed. AWT gets generated by the host operating system.

Swing is a GUI that gets used to create various software. Swing allows the developer to create and scroll bars and buttons for the application. The components of swing got written using the language of Java. 

Comparison Table Between AWT and Swing

UseAWT or Abstract Window Toolkit gets used for developing various GUI programmes in Java.Swing is a Java lightweight GUI, which get used for developing various software applications. 
ComponentsAWT components are heavy-weight than the components of Swing. They provide less powerful components than Swing.Swing components are lighter-weight than the components of AWT. Swing comparatively provide more powerful components than AWT.
Execution TimeIt takes longer to execute than Swing.It takes a shorter time to execute than AWT.
FunctionalityThe functionality of AWT is comparatively lesser than the functionality of Swing.The functionality of Swing is comparatively greater than the functionality of AWT.
DependencyThey are dependent on the provided platform.They are not dependent on the provided platform.
MWC SupportAWT does not support the MWC pattern.Swing supports the MWC pattern.
ClassesThe classes of AWT are JFrame, JEditorPane, JDialog, JDesktopPane, JComponents, Swing contains classes like JradioButton, Jcheckbox, JcolorChooser, JtextField, Jbutton, Jmenu, JtextArea etc.
Package RequiredThe required package for AWT in java.awt.The required package for Swing is javax.swing.

What is AWT?

AWT stands for Abstract Window Toolkit, and it is a part of the Java Foundation Classes. This is a platform-dependent user interface widget toolkit. AWT works as the GUI toolkit for a large number of Java platforms (it is a platform used for developing portable code for mobile phones and other software programmes).

The components of AWT are platform-dependent which means the components of AWT are displayed according to the system which operates it. AWT is also heavy-weight which means, the components of AWT use the resources of the operating system.

The package java.awt gives classes for AWT API. For instance, Choice, CheckBox, RadioButton, Label etc. There are various components of AWT like Container, Window, Panel, Frame, etc. The work of the components of the Container is to contain other components, for example, labels, text fields, buttons etc. Some classes can extend the classes of Container like Dialog, Panel, and Frame.

The Window is another container that does not have any kind of menu bars and borders. To create a Window, one needs to use another window, frame, and dialogue. The other component panels have other components like text fields and buttons. But Panel does not contain menu bars and title bars. The frame is another component that contains components like text fields and buttons. And it also has menu bars and a title bar.

What is Swing?

Swing is a part of JFC (Java Foundation Classes). It is an API (Application Programming Interface. It is a connection between different computer programmes or computers), which gives the GUI (Graphical User Interface) for Java Programs. 

The look and feel (colour, shape, layout, and design) of Swing enhances the look and feel of platforms without making any big changes to the application code. Swing uses a mechanism called pluggable look and feel that changes the look and feel of the GUI (Graphical User Interface). 

Swing has more flexible and powerful components than AWT. They provide some advanced components that are not available in AWT. For instance, tables, trees, scroll panels, tabbed panels, lists, etc. Unlike AWT,  Swings are not platformed dependent. This means that swings are entirely written in Java. 

In December 2018, the successor of Swing JavaFX was released by Sun Microsystem. This is based on the FXML/CSS framework. Its development got started in the year 2005. 

Main Difference Between AWT and Swing

  1. The components of Java AWT are entirely dependent on the platform. On the other hand, the components of Swing does not depend on the platform. Swing components get purely created in Java.
  2. AWT has heavyweight components. Jutton and JtextArea are the heavyweight components. On the other hand, the components of Swing are lightweight because they do not require any operating system for performing their function. For instance, JTextArea, and Jbutton are lightweight components.
  3. AWT components do not support the pluggable feel and look. On the other hand, the components of Swing support the pluggable look and feel of the created application. 
  4. AWT does not have many components as compared to Swing. On the other hand, Swing has a large number of components. For instance scroll panes, tables, lists, tabbed panes, etc.
  5. The package required for AWT components in java.awt. On the other hand, the package that is required for Swing components is javax.swing.
  6. AWT does not provide a more sophisticated set of GUI components. On the other hand, Swing provides a more sophisticated set of GUI components.


AWT is the collection of a large number of API (Abstract Program Interfaces). Java programmers use this API to create GUI (Graphical User Interface). The components of AWT belong to the JFC (Java Foundation Classes). 

Swing uses its lightweight components to develop desktop friendly applications in Java. The components of Swings are entirely written in Java and thus independent of the platform they work on.


  1. https://link.springer.com/chapter/10.1007/978-1-4302-0187-8_4
  2. https://link.springer.com/chapter/10.1007/978-1-4471-0573-2_13