Suppose we have 5 distinct buttons in an UI all of which can generate events. In such case we can --- (1) keep 5 distinct action listener objects to react in 5 different ways when different buttons are pressed. Or, (2) keep one action listener object for those 5 buttons to react in 5 different ways through identifying which button was pressed in runtime (may be through getActionCommand() or some other means). Options (1) has an overhead of creating 5 listener objects while option (2) has overhead of runtime calculation of identifying the specific object requersting for an action. Which option do you think is better in terms of performance, maintainance, scalability or some other importnant features in Java. Your opines pals? :roll:
Ashik Uzzaman Senior Software Engineer, TubeMogul, Emeryville, CA, USA.