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").
all Swing components are lightweight (except for the top-level ones: JWindow, JFrame, JDialog, and JApplet)
I did not quite get:
Is "ancestor" in first citation in the sense of inheritance or in the sense of containment hierarchy?
According to second citation it appears to me that top-level does not have sense of inheritance. Does it mean that any other Swing component will be heavyweigh as soon as an instance at the top of containment hierarchy? i.e. is not inside any other container
Hi G, It has nothing to do with heirarchy. It refers to using the local OS for rendering or just using java to render a component. Top level components (JWindow, JFrame, JDialog, etc) use the OS to render them. This makes them HEAVY because the OS is large and must be present in order for the components to be rendered correctly. Lightweight refers to rendering in Java which is much smaller and portable code. This also allows a component to look the same no matter what OS it is rendered in. Regards, Manfred.
Joined: Aug 30, 2001
Manfred, it does not seem to me being more lightweight when you have heavyweight peers not directly but through ancestors.
the OS is large and must be present in order (/QUOTE) Can you explain how and where it should be present (in class, thru a member)?