Presented below is an interesting example in whihc a JMenu, JToolbar and JButtons on a JFrame are sharing common ActionEvent handlers.

Java Code:
public class ShareAction extends JFrame {
  OpenAction openAction = new OpenAction();
  SaveAction saveAction = new SaveAction();
  QuitAction quitAction = new QuitAction();
  
  public static void main(String argv[]) {
    new ShareAction().setVisible(true);
    }
 
  ShareAction() {
    createMenu();
    createToolBar();
    createButtons();
    pack();
    
    // deal closing via the upper right "X" by redirecting to
    // quitAction
    addWindowListener
     (new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            ActionEvent ae = 
                  new ActionEvent (quitAction,
                       ActionEvent.ACTION_PERFORMED, 
                       "bebye");
            JFrame j = (JFrame)e.getSource();
            j.dispatchEvent(ae); 
            }
     }
     );
    }
  
  public Dimension getPreferredSize() {
    return new Dimension(300,300);
    }
 
  private void createMenu(){
    JMenuBar mb = new JMenuBar();
    JMenu file = new JMenu("File");
    mb.add(file);
    file.add(openAction);
    file.add(saveAction);
    file.add(quitAction);
    setJMenuBar(mb);
    }
  
  private void createToolBar() {
    JToolBar bar = new JToolBar();
    bar.add(openAction);
    bar.add(saveAction);
    bar.add(quitAction);
    getContentPane().add(bar, "North");
    }

  private void createButtons() {
    JPanel j = new JPanel();
    JButton b1 = new JButton("Open");
    JButton b2 = new JButton("Save");
    JButton b3 = new JButton("Quit");
    b1.addActionListener(openAction);
    b2.addActionListener(saveAction);
    b3.addActionListener(quitAction);
    j.add(b1);
    j.add(b2);
    j.add(b3);
    getContentPane().add(j, "East");
    }
}
  
class OpenAction extends AbstractAction {
  public OpenAction() {
    super("Open", new ImageIcon("open.gif"));
    }
  public void actionPerformed(ActionEvent e) {
    System.out.println("Open action");
    }
}
 
class SaveAction extends AbstractAction {
  public SaveAction() {
    super("Save", new ImageIcon("save.gif"));
    }
  public void actionPerformed(ActionEvent e) {
    System.out.println("Save action");
    }
}

class QuitAction extends AbstractAction {
  public QuitAction() {
    super("Quit", new ImageIcon("quit.gif"));
    }
  public void actionPerformed(ActionEvent e) {
    System.out.println("Quit action");
    System.out.println("Bye.");
    System.exit(0);
    }
}