AWT problem on linux

gelderk at natlab.research.philips.com gelderk at natlab.research.philips.com
Thu Sep 10 06:12:21 PDT 1998


> >Who says Component Z can keep the same size if I enlarge Component X
> >in the same Container? 
> 
> That is exactly the problem: nobody. But it happens - check out the
> layoutContainer() log of the attached example (with the Sun AWT, not kaffe).
> Doesn't touch c2, no matter what LayoutManager you use (actually, it doesn't
> even call c2.doLayout());

That's not entirely what I meant, though it comes very close.

If Component Z enlarges, the layout manager of its Container may
decide to make Component X smaller, because X is still bigger than
its minimum size, which has not changed (and neither needs it
preferred size have changed). When X.setBounds() is called, then it
may decide to do its own layout.

Now what I'd like to see in the standard, is that any Component that
is changed in size (be it a Container.add(), a Component.setBounds()
or whatever), causes its parent to do a layout and then does a layout
for itself if it is a Container. 

Hm, I think I now understand what you meant with caching min/pref
sizes... I should have said above ``If Component Z its min/pref size
grows, [...]''. Doing a layout never changes these, only the real
size.

Concerning your example: you change a static field, how can such a
LayoWidget ever know it has actually changed in size? Either you need
an elaborate setH() which notifies all widgets (from a static array or
so) or you need to tell each instance of LayoWidget by hand it has
changed. The only way around it is to run doLayout() unconditionally
through the entire tree, all the time, which is a little too much...

I'll search through the Kaffe-java files to see what I can find on
circumventing the (in)validate() system -- including events. As far as
I know/tested, it is not perfect. I'll give the results Monday. 

Concerning portability: Sun does not do it automagically, if Kaffe
will do it, people might forget to put the invalidate() and validate()
calls in their programs, which causes them not to work properly on
other systems than those running Kaffe. However convenient
circumventing validate() might be, may be we don't want to do it for
the sake of portability.

It's a bigger problem/discussion than I expected :-)

And I can even make it bigger: why does a Frame not know that it
should not be bigger than the size of my screen, or in other words,
why is get/setMaximumSize() not really used? (I don't expect an answer
to this question. :-)

Bye!

+--- Kero ------------------ kero at dds.nl ---+
| I ain't changed,                          |
| but I know I ain't the same               |
+--- M38C --- http://huizen.dds.nl/~kero ---+


More information about the kaffe mailing list