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").
what is the native resource?
Can anyone give me examples of lightweight component and heavy weight component.
Rok Štelcer
Ranch Hand
Joined: Nov 03, 2009
Posts: 101
posted
0
Hi,
thanvi janu wrote:Can anyone give me examples of lightweight component and heavy weight component.
The main difference is that in Swing each component is painted(rendered), while in AWT "everything" is inherited from its native peer.
In particular, these AWT native peers allocate native resources. For example java.awt.TextField allocates an actual text-field-like resource* through the native OS while javax.swing.JTextField does not. JTextField simply draws pixels and interprets mouse events to emulate a native** text field.
footnotes:
*probably, depending on how AWT was ported to the native OS
**or other-than-native, depending on which LookAndFeel is in effect