Skip to content

ActionEvent.getComponent() return Button instance instead of MultiButton one #1655

@JrmyDev

Description

@JrmyDev

In this example :

MultiButton mb = new MultiButton();
mb.addActionListener(new ActionListener(){
   @Override
    public void actionPerformed(ActionEvent evt){
        Component c = evt.getComponent();
   }
});

The Component c is an instance of Button (the emblem button enclosing in the mb MultiButton) instead of the mb instance.
If I would like to retrieve the MultiButton mb that I have triggered, I have to do that :
MultiButton theMButtonTriggered = evt.getComponent().getParent().getParent();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions