Suppai
asked on
Best practice for handling events for multiple gui components
What is the best practice way to handle events, when multiple event sources (e.g. multiple buttons) are present in a gui? Should separate listeners be created or only one with a switch defining the source of the event? Or something else?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sendButton.addActionListen er(new ActionListener()
{
public void actionPerformed(ActionEven t event)
{
send();
}
});
doSomethingElseButton.addA ctionListe ner(new ActionListener()
{
public void actionPerformed(ActionEven t event)
{
doSomethingElse();
}
});
{
public void actionPerformed(ActionEven
{
send();
}
});
doSomethingElseButton.addA
{
public void actionPerformed(ActionEven
{
doSomethingElse();
}
});
ASKER