public void actionPerformed(ActionEvent e)
  {
    if (e.getSource() instanceof JMenuItem)
    {
      int index = popupMenu.getComponentIndex((Component)e.getSource());
      if (index >= 0 && index < items.size())
      {
        ItemEvent ie = new ItemEvent(this, index, items.get(index),
          ItemEvent.SELECTED);
        for (int i = 0; i < itemListeners.size(); i++)
        {
          ItemListener l = (ItemListener)itemListeners.get(i);
          l.itemStateChanged(ie);
        }
      }
    }
    else if (e.getSource() == leftButton)
    {
      leftButton.setSelected(false);

      for (int i = 0; i < actionListeners.size(); i++)
      {
        ActionListener l = (ActionListener)actionListeners.get(i);
        ActionEvent ae = new ActionEvent(this, e.getID(), e.getActionCommand());
        l.actionPerformed(ae);
      }
    }
  }