> from
> http://java.sun.com/products/jfc/tsc/articles/mixing/
[quoted text clipped - 6 lines]
>
> I sitll don't understand this heavy- vs. lightweight component thing..
You understand what a component is?
Now in heavyweight each component has its own canvas to draw on,
in lightweight there is just one canvas ( native screen resource)
(that of java.awt.Window i think) and all the component are painted
by a paintComponents method ( dont know the name exactly),
the paintComponenets will correctly call the paintComponent(Graphics
g) of each component.
understand it?
Thomas Weidenfeller - 01 Sep 2005 07:53 GMT
> You understand what a component is?
> Now in heavyweight each component has its own canvas to draw on,
No, they have a peer which often does the complete drawing on its own,
e.g. by simply using a native widget. Only java.awt.Canvas has a peer
which is supposed to be drawn on by the user.
> in lightweight there is just one canvas ( native screen resource) (that
> of java.awt.Window i think)
First, this is also no canvas. The top-level windows provide a graphics
context to draw on, which is linked to some native peer.
Second, there still can be several native peers in action, e.g. popup
menus or tooltips (partly) outside of a top-level window apparently need
some native support to be rendered.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
> from
> http://java.sun.com/products/jfc/tsc/articles/mixing/
[quoted text clipped - 3 lines]
>
> Please, what is "native screen resource" and what is "peer"?
A "native screen resource" is a generic term that the page you're
reading uses for some platform-specific representation of a GUI
widget/component/control/whatever from the operating system where the
application is running.
Traditionally, operating systems (or windowing systems) provide some
kind of a concept of a GUI "component" or "widget" or "control", all of
which mean approximately the same thing. If I build a typical Windows
application, the operating system kernel knows about each individual
check box or other widget on each of my windows. In other cases, it may
just be a separate process (such as an X Windows server) that knows
about each widget... or even just a user-space library. In any case,
something written in native code is aware of that widget.
The term "peer" is AWT-specific. It refers to the fact that each widget
is represented by an object in Java, and ALSO by some data structure or
object in the native platform. The Java object is called the component,
from AWT's perspective, and the native data structure or object is
called the "peer".
Basically, a heavyweight component has a peer, meaning that it is
implemented with the full consent, knowledge, and cooperation of the
operating system or windowing system. A lightweight component lacks a
peer, which means that the operating system (whether kernel, or separate
process, or user-space library, or whatever) does NOT know about that
object. Instead, the Java virtual machine creates the parent, and keeps
to itself that there is a check box in a certain location.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
>"A heavyweight component is one that is associated with its own native
>screen resource (commonly known as a peer)."
See http://mindprod.com/jgloss/peer.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Frances - 01 Sep 2005 14:20 GMT
>>"A heavyweight component is one that is associated with its own native
>>screen resource (commonly known as a peer)."
>
> See http://mindprod.com/jgloss/peer.html
I should have thought of looking at your glossary... thank you Roedy..
very useful stuff indeed.... :)