How to write alternate panel removeAllComponent() method in vaadin7?

iam learning to vaadin 7.please let me know how to write alternate method panel removeAllComponent() method in vaadin 7

There’s no removeAllComponents() method in Panel, as it only has a single component. What should the alternative method do?

If you want to remove all the components from the content layout of a panel, you could have a subclass such as: class MyPanel extends Panel { ... public void removeAllComponents() { if (getContent() instanceof AbstractComponentContainer) // Just in case if it can be something else ((AbstractComponentContainer)getContent()).removeAllComponents(); } }

I think there is no more need to remove the current content of the panel because it is replaced each time you do :
myPanel.setContent(new Layout);