Whenever you add/remove components you may have to ask swing to do a new layout. You do this with either the JComponent method revalidate or the Container method validate. Sometimes you may have to follow this with a call to repaint. You just have to play with this until you get it to work with the minimum number of calls.
The main clue for the need to validate the layout is that nothing appears until you resize the container.
Joined: May 17, 2003
Gregg, David, Cathy and Craig,
thank you all for your comments.
I have altered my code and now everything is working beautifully -
Hi guys, I have a similar problem. I'm trying to remove the whole content of a JPanel that I have polacved inside an applet. I tried everything, even what you posted and when I get to the part when I modify the panel the whole applet just crashes. I hope you hasve a solution for this. thanks in advance
subject: removing one component and replacing it with another