<AWT Dev> <Swing Dev> Review request #3: 6852592 (revalidate() must be smarter)

Alexander Potochkin Alexander.Potochkin at Sun.COM
Tue Jul 28 09:05:50 PDT 2009

Hello Anthony

> Hi Alex,
> On 7/27/2009 10:18 PM Alexander Potochkin wrote:
>>> Could you please elaborate on possible situations that could break 
>>> after making the Window/Applet the validate root?
>> Let me describe the "best fix"
>> 1) Bring isValidateRoot() up to the Component class
>> 2) Make it return false
>> 3) Leave all other stuff intact
> The current fix does almost that with a few exceptions. Could you please 
> describe at what exact cases promoting the isValidateRoot() to the 
> Component instead of the Container might help? Any concrete existing 
> methods/examples? Unfortunately I hardly see any, but maybe it's just me...
> Also, I would still like to understand how making the Window/Applet 
> class a validate root might harm, so I would kindly ask you to describe 
> a hypothetical case, please.

I believe that I already described one case

As you know the base type that Swing and AWT work with is java.awt.Component

see methods like getParent(), getComponent() etc...

The fix should eliminate the following messy code,
which can be found in JViewport and RepaintManager:

if ((c instanceof JComponent) && (((JComponent)c).isValidateRoot()))

and turn in into

if (c.isValidateRoot())

I also think that, Component.isValidateRoot() will make the fix shorter 
on AWT side, since no casting to Container will be necessary


As for the second question about making Window/Applet validate roots,
I just don't see any practical benefits of this

Could you please give more details why it is worth doing?


> -- 
> best regards,
> Anthony

More information about the awt-dev mailing list