ActionListener vs AbstractAction
<p>i am trying to learn more about event handling but everywhere i read about it,   it's mainly about how to use it so something happens but not how it works.</p>

<p>So far i know about 2 ways to make something happen when a button is clicked.</p>

<p>ActionListener:</p>

<pre><code>myButton.addActionListener(new ActionListener() { @override actionPerformed... });
</code></pre>

<p>and AbstractAction:</p>

<pre><code>public class MyAction extends AbstractAction {
    public MyAction(String text, ImageIcon icon, String desc, Integer mnemonic) {
        super(text, icon);
        putValue(SHORT_DESCRIPTION, desc);
        putValue(MNEMONIC_KEY, mnemonic);
    }
    public void actionPerformed(ActionEvent e) {
        System.out.println("Action", e);
    }
}

MyAction myAction = new MyAction(...);
myButton.setAction(myAction);
</code></pre>

<p>I know that i can write everything i want to happen into the <code>actionPerfomed()</code> method.</p>

<p>But since i do not know, what exactly happens in the background I can not tell if one has any advantage over the other or which one i should use in which situation?</p>