Zeezl
Zeezl

Reputation: 133

How to make content navigation button (remains pressed when clicked) in Vaadin

I created basic vertical layout that work as side menu and now I want to place some buttons in it. Few of them gonna work as common side menu buttons, they just change page content so I want to mark that they are clicked in some way, how can I achive that? Or maybe there is better way?

Upvotes: 0

Views: 98

Answers (1)

Armand Simon
Armand Simon

Reputation: 41

As stated in the 5th version of Vaadin7 manual, you can attach an event listener to the Button.

button.addClickListener(new Button.ClickListener() {
    public void buttonClick(ClickEvent event) {
        // show the button has been clicked with a CSS class:
        button.addStyleName("v-button-clicked");
    }
});

Don’t forget to define the v-button-clicked class. Of course you’re free to add the class of your liking through the .addStyleName() method.

Upvotes: 0

Related Questions