<Swing Dev> redefenition isValid() method from Component

Walter Laan W.Laan at costengineering.eu
Fri Jan 7 10:34:07 UTC 2011


> And if I run this code under openjdk it shows panel with label, but if
I run
> this code under propriertary sunjdk it shows panel without label.
> 
> If comment isValid() method, it works equally.
> 
> Why such a difference and who is working correctly?

Both are working correctly but the Sun/Oracle one has an optimization
(since 6u10 or so) that it doesn't validate the component if it is valid
while the previous version apparently called validate (thus layouts the
label) at least once without checking isValid().

Don't override is valid to return true if your component isn't valid :).

Walter.



More information about the swing-dev mailing list