Actions can be very useful when two objects must perform the same action. For example, if you want a menu item and a button to do the same thing, use an action as follows:
Action act = new AbstractAction("Does something") {
public void actionPerformed(ActionEvent ae) {
System.out.println("Something happened!");
}
};
JMenuItem item = new JMenuItem(act);