Difference between AWT and Swing in Java

Here you will learn about difference between AWT and Swing in Java.

 

AWT and Swing both are used to create GUI interface in Java. Both of them are used to perform almost same work, still they differ from each other. In this tutorial I have shared about some differences between AWT and Swing.

 

Also Read: Difference between Abstract Class and Interface in Java 

Difference between AWT and Swing in java

AWT
Swing
AWT stands for Abstract Window Toolkit.
Swing is a part of Java Foundation Class (JFC).
AWT components are heavy weight.
Swing components are light weight.
AWT components are platform dependent so there look and feel changes according to OS.
Swing components are platform independent so there look and feel remains constant.
AWT components are not very good in look and feel as compared to Swing components. See the button in below image, its look is not good as button created using Swing.
 
Difference between AWT and Swing
Swing components are better in look and feel as compared to AWT. See the button in below image, its look is better than button created using AWT.
 
Difference between AWT and Swing

 

If you know about any other difference between AWT and Swing than please mention it by commenting below.

22 thoughts on “Difference between AWT and Swing in Java”

  1. yes, really the above table has the main difference between AWT and Swing, and i want to know other difference between them?Thanks in advance.

      1. AWT doesn’t support pluggable look and feel
        Swing support pluhhable look up and feel
        AWT doesn’t support MVC(model view control)
        Swing follow MVC
        AWT provide less componets than swing
        Swing provide more powerfull components

  2. With AWT, you have 21 “peers” (one for each control and one for the dialog itself). A “peer” is a widget provided by the operating system, such as a button object or an entry field object.
    while in Swing, you would have only one peer, the operating system’s window object. All of the buttons, entry fields, etc. are drawn by the Swing package on the drawing surface provided by the window object. This is the reason that Swing has more code. It has to draw the button or other control and implement its behavior instead of relying on the host operating system to perform those functions.

Leave a Comment

Your email address will not be published. Required fields are marked *