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 1.4 Game Programming
Java 1.4 Game Programming (Wordware Game and Graphics Library)
ISBN: 1556229631
EAN: 2147483647
Year: 2003
Pages: 237

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net