:: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Categories >> Software >> Java Related >> Java J2EE >> Swing


 Core Java interview questions  Core Java Interview Questions (1728)
 Advanced Java interview questions  Advanced Java Interview Questions (332)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
What is the difference between AWT & Swing?
 Question Submitted By :: Swing
I also faced this Question!!     Answer Posted By  
# 1
AWT are heavy weight components while Swing are light
weight components.
Is This Answer Correct ?    337 Yes 27 No
# 2
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 ?    172 Yes 48 No
# 3
AWT are heavy weight components while Swing are light
weight components
Is This Answer Correct ?    136 Yes 18 No
# 4
AWT are heavy weight components whereas swing is a light
weight component because the swings are not platform
Is This Answer Correct ?    118 Yes 26 No
# 5
this is vinay
1. swing is light weight component and awt is heavy weight
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 ?    88 Yes 22 No
# 6
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
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 ?    83 Yes 22 No
# 7
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 ?    63 Yes 23 No
Java Learner
# 8
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 :
Is This Answer Correct ?    54 Yes 19 No
# 9
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
# 10
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
Is This Answer Correct ?    39 Yes 15 No
Chamil Dias

Other Swing Interview Questions
  Question Asked @ Answers
What are the features of JFC?   1
How are Swing and AWT be differentiated? Wipro 3
when i run Frame program, it display output in supparate window.i try to close using "X" it not close.min'-' & max'+' are working.pls what is problem? i run in editplus. folowing program i given. import java.awt.*; class Form1 { Frame f1=new Frame("loginpage"); Label l1=new Label("username"); Label l2=new Label("password"); TextField tf1=new TextField(); TextField tf2=new TextField(); Button b1=new Button("submit"); Form1() { f1.setLayout(new FlowLayout()); f1.add(l1); f1.add(tf1); f1.add(l2); f1.add(tf2); f1.add(b1); f1.setSize(437,440); f1.setVisible(true); //f1.dispose(); } public static void main(String[] args) { Form1 f=new Form1(); } }   4
what do u mean by GUI framework   1
Name the borders provided by Swing? Accenture 1
What is the base class for all of swing components? Infosys 6
can we create a object in static block class A { static { A a=new A(); } }   7
What are the benefits of using Swing over AWT?   2
What is the difference between AWT and Swing ? TCS 1
what is the diff's between swing and applet? Patni 17
What is the corresponding Layout for Card in Swing? Patni 3
Difference between ligt weight and heavy weight?   5
For more Swing Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::