| Author |
light weight& heavy weight
|
untak goel
Greenhorn
Joined: Apr 26, 2005
Posts: 6
|
|
What do heavy weight components mean? What do light weight components mean? what is the difference b/w them?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 23395
|
|
A "heavyweight component" is a GUI component like a button or combo box which uses the native system's component to draw itself; AWT components are heavyweight. A "lightweight component" doesn't have a native part; it's drawn entirely using the Java2D API. This means that Java can do all sorts of interesting things with the component as far as changing its appearance, combining it with other components, printing it, etc. [ April 26, 2005: Message edited by: Ernest Friedman-Hill ]
|
[Jess in Action][AskingGoodQuestions]
|
 |
untak goel
Greenhorn
Joined: Apr 26, 2005
Posts: 6
|
|
Thanks IS there is any other difference?
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
That's the technical difference. There are many implications about speed, memory usage, how much it looks and behaves like other programs on the same OS, how much it looks and behaves the same on all platforms. People disagree on some of these. Heavy vs light and whether to draw lightweight widgets in native code like Swing or in Java like SWT are contentious topics. One addition to the description above ... a lightweight widget must sit on a heavyweight widget to get any drawing done, so you can't avoid heaveyweight stuff entirely. But a heavyweight panel can contain many lightweight widgets for a significantly lighter whole.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Neeraj Dheer
Ranch Hand
Joined: Mar 30, 2005
Posts: 225
|
|
|
In addition, since the light-weight components are drawn within java, their look and fell can be customised and these components appear the same across platforms(different OSes etc), but since heavyweight components depend on the OS, their look and feel changes across OSes.
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
|
Moving to Swing/AWT...
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
Craig Wood
Ranch Hand
Joined: Jan 14, 2004
Posts: 1535
|
|
Heavy–weight components were the original java components and include classes like Component, Container, Panel, Label, ScrollPane and Checkbox. They are referred to as the AWT (Abstract Window Toolkit). Light–weight components came later, are referred to as Swing and include classes like JComponent, JPanel, JLabel; all preceeded by a 'J'. It is best not to mix them together. Custom painting is different in each system. Swing offers a lot more variety in components and their customization.
|
 |
 |
|
|
subject: light weight& heavy weight
|
|
|