Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2005

Tip: Looking for answers? Try searching our database.

heavy- vs lightweight..

Thread view: 
Frances - 31 Aug 2005 18:10 GMT
from
http://java.sun.com/products/jfc/tsc/articles/mixing/

"A heavyweight component is one that is associated with its own native
screen resource (commonly known as a peer)."

Please, what is "native screen resource" and what is "peer"?  (I looked
up definition of 'peer' in webopedia and Ask Jeeves, but got nowhere..)

I sitll don't understand this heavy- vs. lightweight component thing..

also (and probably related to this question) I would like to know why on
this applet (AWT)
http://www.francesdelrio.com/java/aButtons.html
(SSCCE: http://www.francesdelrio.com/java/aButtons.java)
I see the background (white)

and on this JApplet (which is 200 x 200)
http://www.francesdelrio.com/java/oWin.html
(SSCCE: http://www.francesdelrio.com/java/oWin.java)
I don't see background..

thank you..

Frances
Tjerk Wolterink - 31 Aug 2005 18:45 GMT
> 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/

Chris Smith - 01 Sep 2005 02:00 GMT
> 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

Roedy Green - 01 Sep 2005 04:37 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
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....  :)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.