get Button name...

got

[code]
Button buttonName = new Button(“xyz”, this);

@Override
public void buttonClick(ClickEvent event) {

System.out.println(…?);

}
[/code]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?

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

You also can do this:

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