A DESCRIPTION OF THE REQUEST :
According to this bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4130347
, and my own experience, calling java.awt.Component#remove(*) to remove a component requires a call to revalidate() or validate().
It's not a bug report per se, rather a RFE that the requirements
of the remove() calls be explicitly noted in the javadoc so that
people don't get bitten by this.
I only very occasionally produce code that ever does a
Component#remove()
Component#add()
sequence.
But every time I have, it has been a frustrating experience.
First the code seem to work. Then it doesn't work under odd
situations. Then it does an incompletel repaint.
Eventually..... I either remember or find some comment somewhere about
needing to do a
validate()
repaint()
sequence, and then everything works fine.
If the remove() methods just had a comment along the lines of:
"Client code should call revalidate() and repaint() after completing
modications to the list of child components".
Then that would be one less swing quirk that I have to keep running into.
JUSTIFICATION :
I have been bitten by this a couple of times because it can sometimes work and then mysteriously not work.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It would be useful if the remove()/add() javadoc explicitly stated the requirement.