Difference between ligt weight and heavy weight?

Answers were Sorted based on User's Feedback



Difference between ligt weight and heavy weight?..

Answer / vishwas saxena

1. Heavy weight components are always Rectangle in shape
while light weight may or may not.

2. Heavy weight components borrows the native screen to
paint their components while light weight render their
components by their own screen painting APIs.

3. They differ from z-indexing to each other, heavy weight
components are always displayed at the top of all
lightweight components.

4. Light weight components are faster in response and
performance.

Is This Answer Correct ?    29 Yes 7 No

Difference between ligt weight and heavy weight?..

Answer / modi[achir communication]

[Short answer: threads are lightweight, programs (aka
processes or tasks) are heavyweight. -Alex]

Lightweight and heavyweight processes refer the mechanics of
a multi-processing system.

In a lightweight process, threads are used to divvy up the
workload. Here you would see one process executing in the OS
(for this application or service.) This process would posess
1 or more threads. Each of the threads in this process
shares the same address space. Because threads share their
address space, communication between the threads is simple
and efficient. Each thread could be compared to a process in
a heavyweight scenario.

In a heavyweight process, new processes are created to
perform the work in parallel. Here (for the same application
or service), you would see multiple processes running. Each
heavyweight process contains its own address space.
Communication between these processes would involve
additional communications mechanisms such as sockets or pipes.

The benefits of a lightweight process come from the
conservation of resources. Since threads use the same code
section, data section and OS resources, less overall
resources are used. The drawback is now you have to ensure
your system is thread-safe. You have to make sure the
threads don't step on each other. Fortunately, Java provides
the necessary tools to allow you to do this.

Is This Answer Correct ?    14 Yes 4 No

Difference between ligt weight and heavy weight?..

Answer / suresh kumar

The Heavy weight components are drawn by the os when the
programs are executed.

For eg: AWT programs

So what happen is when we tried to the run that class file
of a AWT program, it will change its appearance because,
here the components are drawn the os again bt in another
system.

But the light weight components are by the java program
itself.

For eg: Swing programs.

So whenever we tried to run the class file in any system it
does not change its appearance

Is This Answer Correct ?    7 Yes 2 No

Difference between ligt weight and heavy weight?..

Answer / mukesh jha

A heavyweight component relies on native code for its visual
representation so it is drawn by the underlying operating
system. Heavyweight components are those defined in the
java.awt package

A lightweight component does not rely on native code - it is
implemented entirely in Java. This means that a lightweight
componet is entirely portable.

One consequence of the difference between heavyweight and
lightweight components is that mixing them in the same
application can cause trouble because they are drawn in
different ways. You should avoid mixing them.

Is This Answer Correct ?    1 Yes 0 No

Difference between ligt weight and heavy weight?..

Answer / aileen

2, light weight components borrows the native screen to
paint their components while Heavy weight render their
components by their own screen painting APIs.

Is This Answer Correct ?    5 Yes 14 No

Post New Answer

More Swing Interview Questions

Hello Everyone.. I m trying to develop a java swing application where i can display a doc file Jeditorpane or Jtextpane.

0 Answers  


Is there any heavyweight component in swings?

0 Answers  


Is java swing still used?

0 Answers  


Name the borders provided by Swing?

1 Answers   Accenture,


Write a program to paint the off-screen buffer in swings

0 Answers  






Is swing better than awt?

0 Answers  


What is import javax swing * used for?

0 Answers  


What is java swing used for?

0 Answers  


What is meant by JFC?

6 Answers   Mindlogicx, SDS,


how to give transparency to JComboBox,JList and JTable

5 Answers   Ness Technologies,


What are the benefits if Swing over AWT?

0 Answers  


What is the difference between swing and applet?

0 Answers  


Categories