application like button behavior

Hi all,

I have a vaadin application that redirect after login to a view with header / left menu and a main panel.

how can I set the menu or any link to switch the main panel according to a specific contents

example: If I click contact It replace the previous content of the main panel by ContactLayout.

how should I implement the click listner to do that ?


Button contactButton = new Button("Contacts");
contactButton.addListener(new Button.clickListener() {
            public void buttonClick(ClickEvent event) {

Where contactLayout is the
that you want to display and mainPanel is a instance of
. If mainPanel also is a
then use mainPanel.removeAllComponents(); and mainPanel.addComponent(contactLayout); instead.

I also suggest you take a look at
which should help you similar questions that might come up in the future.