This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: AWT


Per Bothner wrote:
> The defining property of heavyweight/lightweight is whether there
> is a Peer associated with the component.  Period.  Whether there
> is an X window associated with the Peer is an implementation
> issue.

I've been looking for weeks for something in writing that says exactly
this, and it's been awfully hard to come by. Can you point me to
something from Sun that says this? I've seen the words "lightweight" and
"peerless" used in the same sentence, but I've never seen anything that
looks like a definition until I read your "Period". Quite the opposite,
I find this sentence in
http://java.sun.com/products/jdk/1.2/docs/guide/awt/designspec/lightweights.html:

"The Lightweight UI Framework is very simple -- it boils down to the
ability to now directly extend the java.awt.Component and
java.awt.Container classes in order to create components which do not
have native opaque windows associated with them."

I'm well aware that MSWindows does not look anything like X's
client-server architecture. But give or take the choice of language, the
distinction still fits: what Sun calls a lightweight toolkit is
reimplementing a lot of functionality for window management and event
dispatching that is already provided by the underlying window system -
on X, MSWindows, and everywhere else.

Nathan


Per Bothner wrote:
> 
> Nathan Meyers <nmeyers@teleport.com> writes:
> 
> > Jeff has it right: "heavyweight" means there's a window being used in
> > the native system, "lightweight" means the window is entirely virtual
> > and exists only in the mind of the X client.
> 
> Er, this may be how *you* define heavyweight/lightweight,
> and they may be *attributes* of heavyweight/lightweight as
> implemented on X, but they are clearly not defining properties
> of heavyweight/lightweight when we are talking about Java
> - most Java implementation do not use an "X client".
> 
> (Note *all* windows are virtual - as far as I know very few X servers
> can allocate specific hardware to windows.)
> 
> The defining property of heavyweight/lightweight is whether there
> is a Peer associated with the component.  Period.  Whether there
> is an X window associated with the Peer is an implementation
> issue.
> 
> > Say you've got a text field in the middle of your GUI for which you want
> > a different mouse cursor than the rest of the GUI: the mouse becomes a
> > text cursor when it enters and a default cursor when it leaves. ...
> > How does a lightweight toolkit do it? It has to track all mouse movement
> > in the application.
> 
> Clearly, a pure lightweight approach is inefficient in this case.
> (Though how much does it matter these days?)  But Swing was restricted
> to being Pure Java.  If we re-implement Swing, we could use native
> X windows where it makes sense.
> 
> I don't think we're disagreeing on implementation issues;  the main
> disagreement is on terminology.
> --
>         --Per Bothner
> bothner@pacbell.net  per@bothner.com   http://home.pacbell.net/bothner/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]