What is better to use: Action vs ActionListener?
action, actionlistener, java, swing, user-interface
Solution
An `Action` is preferred if you need to share functionality across components. From the docs
if you have two or more components that perform the same function, consider using an Action object to implement the function.
but also says
An Action object is an action listener that provides not only action-event handling, but also centralized handling of the state of action-event-firing components such as tool bar buttons, menu items, common buttons, and text fields. The state that an action can handle includes text, icon, mnemonic, enabled, and selected status.
Problem
Myself, I always use `ActionListener` as swing event-handler (e.g. button-click), and it is the most common listener I've seen in most swing applications. However, Some Swing professionals here in stackoverflow often advise to use `Action` rather than `ActionListener`. What benefits I get from doing so?