What are the differences between AWT and Swing

Showing Answers 1 - 29 of 29 Answers


  • Jun 3rd, 2005

AWT - Heavy weight component. Every graphical units it will invoke native methods. 
SWING - Light weight component. It doesn't invoke native methods. 

lokesh mishra

  • Jul 21st, 2005

Swing is based on MVC architetcure(Model view Controller) and thats why its look and feel is independent of hardware and OS...whereas AWT look and feel depends upon the platform...


  • Jul 25th, 2005

Mr. Lokesh Mishra...let me correct you....swing came into existence long back when no body heard about MVC Architecture. 
And for the answer of the question, I would like to add another point to Samuel's answer i.e 
SWING is an extension of AWT.....having advance controls and with extra features of previously present controls 

  Was this answer useful?  Yes

anil sharma

  • Jul 27th, 2005

Swing are the extension of Awt. 
Awt have some disadvanage that are removed by he swing .for example 
awt programs are not machine independent. 
it causes some problem on different machine 
whereas his does not occur in swing. 

satyendra chaudhary

  • Jul 30th, 2005

actually awt methods and classes r tied to the local machine on which the application or applet executes....thats why call heavy-weighted cause the appreance will change from plateform to plateform.....where as the swing is fully written in java and its capablities r not tried to local plateforf(lightweight)

  Was this answer useful?  Yes


  • Aug 5th, 2005

AWT are Heavy Weight Components and Swings are Light Weight Components. But Swings are extension of AWTs only.

  Was this answer useful?  Yes

Sachin Dhanmane

  • Aug 29th, 2005

Good answer

  Was this answer useful?  Yes

atul kabra

  • Sep 12th, 2005

swing components have different look and feel also swing uses the model view controller architecture. Swing compoent is a light weight component where as awt is heavy weight compoent. Swing provides some advanced compoent like JTree, JTabbedPane, JList and many more

  Was this answer useful?  Yes

Mohammed Farooq ali

  • Sep 18th, 2005

AWT is heavy weight component whereas Swings is a light weight. Swings has pluggable look'n'feel architecture. AWT occupies more memory space unlike Swings which occupies less memory space.

  Was this answer useful?  Yes


  • Sep 22nd, 2005

hi to every body.AWT is platform dependent and SWING is platform independent. swing includes more graphic components then awt.Ritesh sharma


  • Sep 28th, 2005

AWT is heavy weight components which take time for loading. Swing is light weight components which take more time for first time loading after then its uses allready loaded componets. so that swing is faster than awt components. -- jayant dhargawe

  Was this answer useful?  Yes


  • Sep 29th, 2005


the major defferense between awt and swings is

awt is heavy weight component nothing but it is based on operating system.

but the swings are light weight components,this is the independent of operating system.

  Was this answer useful?  Yes

Ajay Srivastav

  • Oct 15th, 2005

Swing is light weight compnent then awt.& contain some extra component then awt

  Was this answer useful?  Yes

Devidas Sonawane

  • Oct 21st, 2005

Awt is heavy weight component and swing is light weight components,  look and fill feature and also platform independance.

  Was this answer useful?  Yes


  • Aug 3rd, 2006

In AWT, native "peer" code, written in a language like C or C++, It uses system callls display widgets. So it is not plateform independent and it heavy weight .Other side swings , native "peer" code is written in java itself which uses JRE which is specific to the plateform , so the code what we write is platefom independent and light weight .

  Was this answer useful?  Yes

shyam nair

  • Sep 20th, 2006

Hi Guys,

              The difference between swings and Awt components are

       1. the base difference that which already everyone mentioned is that One is heavy weight and other is light weight. Let me explain, bacially what the term heavy weight means is that when you are using the awt components the native code used for getting the view component is generated by the Operating System, thats why it the look and feel changes from OS to OS. Where as in swing components its the responsibility of jvm to generate the view for the components. Another statement which i saw is that swing is MVC based and awt is not. First of all let me tell one thing MVC is not a programming technique, its only a pattern. In the sense it is a way of implementation, or in other words, a pattern is a non-recurring solution to a recurring problem. Its up to the programmer that whether you should follow the MVC or not with your components. If the programmer needs what i will say is that its he can implement the concept of MVC in both awt and swings.


Thats all





  • Sep 21st, 2006

Swing is an extension of, and not a replacement for the AWT. There is some overlap between AWT and Swing (for example a Swing JButton component might

  Was this answer useful?  Yes

hitesh karel

  • Nov 3rd, 2006

Everyone saying that AWT - Heavy weight and Swing - light Weight.But what is meaning here Weight here.

  Was this answer useful?  Yes

Hari krishnan.s

  • Mar 27th, 2007

The main difference between Swing and Awt is that Awt components are peer components to the native widgets. In other words, when you allocate a Button, the java code uses a native component that the OS knows about for that button. All drawing and event handling happens at the OS level. (ie Windows or X Windows code is handling those two areas). AWT listens for events, and calls your hooks for you to interact with them. This implemenation is usually referred to as a heavyweight component. AWT components are heavyweight.

Swing is pure Java. Most of the components that Swing uses are referred to as lightweight. Both drawing and events are handled by Java code. This makes applications much more portable, Primiarily, because heavyweight event notification is dependant on the OS' implementation. However, since drawing is done by Java code this places a lot of burden on performance of java. In 1.4 swing performance is a lot faster than in previous versions. (Actually, this will be more true in 1.4.1 as there is a bug that Sun is working on that degrades performance of all Java apps using 1.4). You can intermix the AWT and Swing. Heavyweight and lightweigh components in the same application, but there are some limitations to doing that. Swing is very flexible, and very nice to work with. (Some days ;-)

Finally, another major difference is that AWT does not support fancy widgets like tables, trees, or formated text components. AWT was originally designed to be very simple. And, it is, but you don't get very useful widgets with it, IMHO. You could try using SWT by IBM which is like AWT in the fact that it too is heavy weight, and it provides more up to date pallette of widgets. It's not as nicely designed as Swing.

  Was this answer useful?  Yes


  • Apr 11th, 2007

In AWT (Abstract Window Toolkit) there is no main method in the program. In Swing there is a main method in the program.
Swing is an extension of AWT.
There is a new concept called SWT (Standard Widget Toolkit).
SWT is an extension of Swing.



  • Apr 11th, 2007

AWT - Heavy weight component. For every graphical unit it will allocate many resources and waste of resources. AWT does't have opearting platform window.

SWING - Light weight component. it's has own operating platform window.
It's has many features.

  Was this answer useful?  Yes

Mohan Seripalli

  • Aug 30th, 2007

I would like to add one more difference.
AWT components(Button, Label, etc.,) are multi-thread safe.
Swing Components(JButton, JLabel ,etc., ) are not designed to be thread safe. The main reason is to gain performance. The java developer is responsible to handle any thread safety for swing components.

  Was this answer useful?  Yes

Swings are lightweight components,Double buffered,Supports tool tip properties,Swings are extension of AWT not a replacement for AWT.It does not interact with native code.

AWT are heavyweight components,Intract with native code and doesnt supports tool tip properties.

  Was this answer useful?  Yes


  • Apr 20th, 2010

AWT are heavy weight components while Swing are light weight components.  Light weight components have transparent pixels where as heavy weight is always opaque.  Light weight components are non-rectangular.  Heavy weight components are rectangular.

  Was this answer useful?  Yes


  • Nov 28th, 2011

Dear Sir/madam

If AWT is platform dependent then how we can say that the Java is not platform dependent.
please explain me.

Thank you

  Was this answer useful?  Yes


  • Jan 16th, 2012


They are right !!!! since AWT is platform dependent which behaves differently in different platforms which defeats our Write Once and Run anywhere.The Java Native Interface (JNI) enabled developers to add platform-dependent functionality to Java applications.
Here in case of AWT we can use AWT Native Interface is which very similar to the JNI.

  Was this answer useful?  Yes


  • Jan 20th, 2012

As far as I know Java itself acts a platform which will be used by AWT.

  Was this answer useful?  Yes

girish kumar

  • Jan 4th, 2016

Explain native code used by awt

  Was this answer useful?  Yes

himanshu verma

  • Jan 27th, 2016

There are so many difference between Swing and AWT.

Swing is light weight and platform independent while AWT is heavy-weight and platform dependent features.

Swing has some extra components such as JColorChoser while AWT does not have.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions