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 ?

thanks

Button contactButton = new Button("Contacts");
contactButton.addListener(new Button.clickListener() {
           @Override
            public void buttonClick(ClickEvent event) {
                      mainPanel.setContent(contactLayout);
            }
}

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

I also suggest you take a look at
http://vaadin.com/book/
which should help you similar questions that might come up in the future.