This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] Small fixes to AWT
On Tue, 2004-02-10 at 11:53, Thomas Fitzsimmons wrote:
> On Tue, 2004-02-10 at 11:07, David Jee wrote:
> > * java/awt/Component.java
> > (show): Invalidate after show or hide.
> >
>
> What problem does this one fix? If invalidation really is needed
> shouldn't it occur in show() and hide() themselves, since they can be
> called directly?
When setVisible() is called on a component, we need to invalidate the
component and its parent container, in order to ensure that the parent
container's children are laid out properly to reflect the change. For
example, in BorderLayout, if you have two visible components, one in
CENTER and one in EAST, and you setVisible(false) on the EAST component,
the EAST container should disappear and the CENTER component should span
the entire width of the parent container. If you setVisible(true) on
the EAST component, then the CENTER component should shrink to make room
for the EAST component.
setVisible(boolean) is an alias method for the deprecated show(boolean),
which calls show() or hide() depending on the boolean value. Regardless
of the boolean value, we should invalidate the component.
I hope that's clear. :)
-David Jee