• Post Reply Bookmark Topic Watch Topic
  • New Topic

light weight& heavy weight

 
untak goel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
untak goel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

IS there is any other difference?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Neeraj Dheer
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing/AWT...
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!