Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


What is the difference between AWT & Swing?

Answers were Sorted based on User's Feedback



What is the difference between AWT & Swing?..

Answer / guest

AWT are heavy weight components while Swing are light
weight components.

Is This Answer Correct ?    363 Yes 30 No

What is the difference between AWT & Swing?..

Answer / g.lakshmi

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

Is This Answer Correct ?    182 Yes 49 No

What is the difference between AWT & Swing?..

Answer / sanjeev

AWT are heavy weight components while Swing are light
weight components

Is This Answer Correct ?    146 Yes 18 No

What is the difference between AWT & Swing?..

Answer / tina

AWT are heavy weight components whereas swing is a light
weight component because the swings are not platform
specific.

Is This Answer Correct ?    126 Yes 26 No

What is the difference between AWT & Swing?..

Answer / vinay

this is vinay
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 ?    101 Yes 25 No

What is the difference between AWT & Swing?..

Answer / harivardhan.a

Most of the issues related to mixing AWT and Swing
components are related to the mixing of so-called
heavyweight and lightweight components. A heavyweight
component is one that is associated with its own native
screen resource (commonly known as a peer). A lightweight
component is one that "borrows" the screen resource of an
ancestor (which means it has no native resource of its
own -- so it's "lighter").

(Lightweight component support was introduced in JDK1.1,
and you can read more about it in the

We generally don't recommend mixing Swing and AWT
components because there are significant benefits in
sticking with programs that are written entirely in Swing
(and thus use only lightweight components).
Some of the benefits of using Swing components are:
More efficient use of resources: Lightweight
components are really "lighter" than heavyweight
components.
More consistency across platforms because Swing is
written entirely in Java.
Cleaner look-and-feel integration: You can give a
set of components a matching look-and-feel by implementing
them using Swing.
Despite the benefits of using Swing components exclusively,
a developer may sometimes have to mix AWT components and
Swing components in the same program (even when migration
is not to blame). For example, such mixing may be required
when a Swing version of a particular AWT component is not
yet available.
Because there's sometimes no alternative to mixing
heavyweight and lightweight components, we have provided a
few options in Swing to make a certain level of component-
mixing possible. However, as anyone who has tried this
approach knows, there are some practical limitations to
this approach

There are some significant differences between lightweight
and heavyweight components. And, since all AWT components
are heavyweight and all Swing components are lightweight
(except for the top-level ones: JWindow, JFrame, JDialog,
and JApplet), these differences become painfully apparent
when you start mixing Swing components with AWT components.

Is This Answer Correct ?    87 Yes 23 No

What is the difference between AWT & Swing?..

Answer / java learner

Main differences:
1. Awt components are heavy weight whereas swing components are light weight, heavy weight are those which are os dependent.

2. A swing has extra components like table,tree,optionalpanel with the class named JTree,JTable,JOptionalPane etc.


3. Swing components support MVC (model,view,control architecture) whereas awt components support Delegate Event Model.

4. Swing components provide dynamic look and feel whereas awt components provide static look and feel.



the awt is the base, its components are heavy weight as they are operating system dependent.To solve this problem we introduce swing
the swing self built components which are not inherited from awt are light weight .Still a major problem with swing
is that the components it inherited from awt are atill heavy this problem is solved by hidden container ContentPane which u can get by method getContentPane()

Is This Answer Correct ?    66 Yes 23 No

What is the difference between AWT & Swing?..

Answer / hemz

The classes contained in the java.awt package provide a
basic capability to create graphical user interfaces, but
the scope of the tools contained in java.awt is limited.
Furthermore, the actual implementation of the components is
done in a language other than Java, and the look and
behavior of the components is somewhat dependent on the
runtime platform's native environment. AWT components might
act slightly differently on a UNIX system than they would on
a PC.

The Swing classes are the next-generation (Java 2) GUI
classes. They provide a number of new components including
trees, tables, and tooltips, etc. Swing components are
written entirely in Java...

You can read more about swing here :
www.roseindia.net/java/example/java/swing/

Is This Answer Correct ?    56 Yes 19 No

What is the difference between AWT & Swing?..

Answer / chamil dias

AWT components use native methods whereas Swing components
use the methods that are written in Java.
AWT components are Heavy weight and Swing components are
Light weight.
Awt is not platform independent where as swing is platform
independent

Is This Answer Correct ?    40 Yes 15 No

What is the difference between AWT & Swing?..

Answer / dinesh

AWT are heavy weight components in the sense that they are
platform dependent means those features are tied to the
OS.But Swings are light weight components i.e.,they are
platform independent GUI.

Is This Answer Correct ?    39 Yes 14 No

Post New Answer

More Swing Interview Questions

Explain the difference between swing and jsf.

0 Answers  


What are the benefits if Swing over AWT?

0 Answers  


What is an on stage swing?

0 Answers  


Is swing an api?

0 Answers  


What is the use of jfc in java swing?

0 Answers  






What method is used to specify a container's layout?

0 Answers  


How do you swing an applet?

0 Answers  


What are the components of java swing?

0 Answers  


Why are swings considered lightweight?

0 Answers  


What is the relationship between clipping and repainting?

0 Answers  


What is difference between swing and awt?

0 Answers  


What is swing delegation event model in java?

0 Answers  


Categories