JaVa
   

Heavyweight and Lightweight Components

A heavyweight component is directly associated with a native screen resource and is known as a peer. A lightweight component, on the other hand, just "borrows" a screen resource, and hence it has no native resource of its own. One of the main differences between lightweight and heavyweight components is that heavyweight components must be opaque (i.e., no transparency), implying that they will be rectangular. On the contrary, lightweight components can contain transparency. With mouse events, a heavyweight component does not pass mouse events to the parent, whereas a lightweight component will.

Finally, and most importantly, if a lightweight component overlaps and is placed above a heavyweight component, the heavyweight component will actually appear above the lightweight component.

JaVa
   
Comments