playing with compontents in the layout

Hi,

As a newbee i am playing with components and layouts.
I am using a horizontal layout with three components.
The first (left) component is a tree.
The second (middle) is a menu.
The third (right side) is a random component in function what is selected in the menu (second component in the horizontal layout)

What is the best way to remove an early showed component ( on the right side).
And open a new one. Is there a function to remove a component on a certain place in the layout?

Thanx in advace.

thirdComponent.removAllComponents();

Here is the
link
.