Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

get Button name...

Rafal Kozyra
8 years ago Oct 15, 2014 4:49pm
Marcus Hellberg
8 years ago Oct 15, 2014 9:30pm

will return the clicked Button. You can then call getCaption() if you wanted the caption.

David Ortega
8 years ago Oct 16, 2014 6:34am

Rafal Kozyra: got 

Button buttonName = new Button("xyz", this);

    public void buttonClick(ClickEvent event) {



how to get object name when clicked?... it should print -->  buttonName  

I can get button caption -> event.getButton().getCaption().

But dont know how i could get this buttonName?


You also can do this:

sample = new Button("Click");
sample.addClickListener(new ClickListener() {
public void buttonClick(final ClickEvent event) {
   Notification.show("The button was clicked",