• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

light weight& heavy weight

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do heavy weight components mean?

What do light weight components mean?

what is the difference b/w them?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks

IS there is any other difference?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Swing/AWT...
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic