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.
|
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.
|
If you know about any other difference between AWT and Swing than please mention it by commenting below.
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.
AWT does not follow MVC (model view controller)
while swing follows MVC
Thnq very much
this really helped me….
Awt components requres java.awt package
Swing components requries javax.swing packagw
thank you
Swing is based upon MFC(Model View Controller)
But, awt is not.
i found it helpful thank you
Thanks, it’s very useful!
thanks
Thank you very much.
thankx a lot … but what is the actual meaning of heavy weight and light weight in java … example plzzzz
AWT Components are heavyweight because of their dependency on native libraries while Swing components are lightweight due to their independence of native libraries. For more explanation you can check this http://stackoverflow.com/questions/672238/of-swing-and-awt-why-is-one-considered-light-weight-and-the-other-heavy-weight
I hope this will clear your doubt.
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
Thanks …
this site is vry helpful..it’s representation is vry easy to make undestand anythng
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.
Helpful…. Thank you soo much!!!
thanks very much i understand clearly
ok what shall i do
10q you described it to me very easly…10q v much
The application developed in awt is faster compared to swing