Button Lazyaction

I’m looking for some example how to pass the action lazily. I’ve a common ButtonListLayout which has set of Buttons. Now, I want to pass different actions to those buttons. How do I do that?

Button also has addClickListener. There is no need to add it in the constructor

Yes I just found it but I don’t know how to use it

 public void createBtnAction(ComponentEventListener<ClickEvent<Button>> clickEventComponentEventListener) {
        createbtn.addClickListener(clickEventComponentEventListener);
    }

I created something like this. But not sure how to pass the arugment

Like you do with the normal button

event → { do stuff }

I’ve something like this
image.png

For each button, I want to register different actions. I want to pass those actions only ``ActionButtons ac = new ActionsButtons(); ac.createbtn( here I want to pass the action)

event → { do stuff } still holds true

The aim is to make this generic, so that I can use this where ever I want

Sorry, I’m still not understanding. How each button knows what action it has to do

That’s up to you :wink:

ac.createBtn(e → { do 1});

ac.editBtn(e → { do 1});

Thanks. I was thinking that I’ve to pass an CLickEvent argument

which is not the case

Thanks for enlightening me