How to remove component from container
Suppose we have JPanel with name panel and JButton with name button on it.
Try this code:
panel.remove(button);
makes button unaccessable but still displayed.
The correct code is:
panel.remove(button);
panel.revalidate(); //resize panel if needed
panel.repaint();
Related posts:























