If you use this , in order for this process ActionEvents from multiple sources, you need to add logic to check the source or command line of the action. This is perfectly reasonable.
If you use other classes, you can use ActionListeners that are implemented elsewhere, or reuse those that were designed for a specific general purpose, or define, for example. Anonymous inner classes that may be convenient in your situation. It is also quite reasonable.
Do not think in terms of “advantages” or “disadvantages” - this is such a common mistake (is it “bad” to do xyz? Is xyz “good practice”?). You use what matters most to your situation and provides the clearest, most repaired, properly functioning code. Be common sense, be familiar with the language you work in, and the options available, make reasonable judgments. Language is a way of expressing an idea, clearly speaking (of type).
source share