Extending custom component

I was looking through the book of vaadin, I saw something on extending customcomponent, So i am wondering is there any difference between extending a container say a Panel or VerticalLayout /HorizontalLayout than extending CustomComponent.?


CustomComponent doesn’t support addComponent(…), so even if you set the extended component’s composition root as a VerticalLayout only the extended component’s own methods can add (or remove) other components to it. You can of course write your own method for adding components from the outside too, but if you don’t want to limit that in any way you could just as well extend the VerticalLayout directly.