What is the difference between AWT & Swing?

Answers were Sorted based on User's Feedback



What is the difference between AWT & Swing?..

Answer / tushar

1.Swing is also called as JFC’s (Java Foundation classes)
and AWT stands for Abstract windows toolkit.

2.AWT components are called Heavyweight component and
Swings are called light weight component because swing
components sits on the top of AWT components and do the
work.

3. Swing components require javax.swing package where as
AWT components require java.awt package .

4.swings components are made in purely java and they are
platform independent whereas AWT components are platform
dependent.

5.we can have different look and feel in Swing whereas this
feature is not supported in AWT.

6.Swing has many advanced features like JTabel, Jtabbed
pane which is not available in AWT. Also. Swing components
are called "lightweight" because they do not require a
native OS object to implement their functionality. JDialog
and JFrame are heavyweight, because they do have a peer. So
components like JButton, JTextArea, etc., are lightweight
because they do not have an OS peer.

7.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.

8.With 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.

9.Several consequences result from this difference between
AWT and Swing. AWT is a thin layer of code on top of the
OS, whereas Swing is much larger. Swing also has very much
richer functionality.

10.Using AWT, you have to implement a lot of things
yourself, while Swing has them built in. For GUI-intensive
work, AWT feels very primitive to work with compared to
Swing. Because Swing implements GUI functionality itself
rather than relying on the host OS, it can offer a richer
environment on all platforms Java runs on.

Is This Answer Correct ?    20 Yes 3 No

What is the difference between AWT & Swing?..

Answer / patta jagadeeswara rao

AWT:-
1. awt components are heavy weight components.
2. platform dependent (operating system based)
3. fixed source is available.
4. it don't have any prefix letters.
5. performance is poor quality.
6. these components are available at java.awt package
SWING: -
1. swing components are light weight components.
2. swing components are the platform independent.
3. dynamic source is available.
4. it have a prefix letter that is 'j' eg:- jtext, jlabel, etc..
5. the swing components are available at java.swing package.

FOR MORE ANSWERS VISIT : http://www.competitivebooks.com

Is This Answer Correct ?    8 Yes 0 No

What is the difference between AWT & Swing?..

Answer / naveen

The difference is
------>AWT is internally depends on C language ..so the look
and feel is different for different operating systems.
for example if we create a component like submit box or a
text box in AWT the look will be one for windows ans
different for unix operating system
but swings is purely plat form independent so that the
component will have the same look and feel in any operating
system......

Is This Answer Correct ?    6 Yes 1 No

What is the difference between AWT & Swing?..

Answer / shiva

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

Is This Answer Correct ?    3 Yes 0 No

What is the difference between AWT & Swing?..

Answer / vinay agrawal

this is vinay agrawal
1. swing is light weight component and awt is heavy weight
component.
2. swing components require javax.swing package where as
awt comonents require java.awt package
3. awt requres native code to execute/run but not swings
4. swing are also known as JFC's
5. swing is a look and feel component and it is purely
developed in java.

Is This Answer Correct ?    3 Yes 0 No

What is the difference between AWT & Swing?..

Answer / kalyan

Awt is heavy weight and swings are light weight

awt is developed by using native methods(c,c++), where as swings are developed by pure java so they are light weight.

swigs are more look and feel whereas awt is not

Is This Answer Correct ?    4 Yes 1 No

What is the difference between AWT & Swing?..

Answer / a.lakshmi

AWT components are heavy weight components,these components have less functionality and it is not user friendly. AWT components are platform dependent.

swing components are light weight components,it is platform independent,these components have more functionality and it is user friendly.

Is This Answer Correct ?    3 Yes 0 No

What is the difference between AWT & Swing?..

Answer / rananjai maurya

1--Swing is light weight component and awt is heavy weight component, heavy weight are those which are os dependent.

2--swing is also called as JFC(java foundation classes)and awt stands for abstract window toolkit.

3--swings component require javax.swing package where as awt component require java.awt.

4--A swing has extra component like table tree optionpanel with the class named JTree,JTable,JOption Pane etc.

Is This Answer Correct ?    3 Yes 1 No

What is the difference between AWT & Swing?..

Answer / prerna keshari

One more difference guys...

Mouse event on a lightweight component fall through it's
parents, but for heavyweight components it does not fall
through it's parents.

Is This Answer Correct ?    5 Yes 4 No

What is the difference between AWT & Swing?..

Answer / shiva

swings are System independent,but Awt System dependent

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More Swing Interview Questions

am searching for the job based on java, swing, currently working small company. they are not giving any salary slip, offer letter. so if i try outside for MNC's they start with previous company details. what should i do..? please help me to get job and make my career.

0 Answers   eClinicalWorks,


Why is model-view-controller architecture used in swing?

0 Answers  


How are Swing and AWT be differentiated?

3 Answers   Wipro,


Explain the difference between awt and swt.

0 Answers  


What are the advantage of swing over awt?

0 Answers  






What things to do to make a web browser compatibale for swing components?

1 Answers   Tesco, TracFone, Wipro,


Hello ..Friends. I need a Code which makes a software of Enter the cheque Details.. means any enduser enter the details in a Particular field that should be printed on the paper On Cheque. at the backend side it sholud be printed on pdf file. Thanks in Advance

0 Answers  


What are the benefits of using Swing over AWT?

5 Answers  


What is jpanel swing?

0 Answers  


What is the what is the difference between invokeandwait() and invokelater()? ?

0 Answers  


What are heavy weight components ?

0 Answers  


How to change button color in java swing?

0 Answers  


Categories