public void mouseClicked(MouseEvent me) {
	  BeanInstance bi = BeanInstance.findInstance(me.getPoint());
	  if (m_mode == ADDING || m_mode == NONE) {
	    // try and popup a context sensitive menu if we have
	    // been clicked over a bean.
	    if (bi != null) {
	      JComponent bc = (JComponent)bi.getBean();
              // if we've been double clicked, then popup customizer
              // as long as we're not a meta bean
              if (me.getClickCount() == 2 && !(bc instanceof MetaBean)) {
                try {
                  Class custClass = 
                    Introspector.getBeanInfo(bc.getClass()).getBeanDescriptor().getCustomizerClass();
                  if (custClass != null) {
                    if (bc instanceof BeanCommon) {
                      if (!((BeanCommon)bc).
                          isBusy()) {
                        popupCustomizer(custClass, bc);
                      }
                    } else {
                      popupCustomizer(custClass, bc);
                    }
                  }
                } catch (IntrospectionException ex) {
                  ex.printStackTrace();
                }
              } else if (((me.getModifiers() & InputEvent.BUTTON1_MASK)
                          != InputEvent.BUTTON1_MASK) || me.isAltDown()) {
		doPopup(me.getPoint(), bi, me.getX(), me.getY());
	      }
	    } else {
	      if (((me.getModifiers() & InputEvent.BUTTON1_MASK)
		   != InputEvent.BUTTON1_MASK) || me.isAltDown()) {
		// find connections if any close to this point
		int delta = 10;
		deleteConnectionPopup(BeanConnection.
		      getClosestConnections(new Point(me.getX(), me.getY()), 
					    delta), me.getX(), me.getY());
	      } else if (m_toolBarBean != null) {
		// otherwise, if a toolbar button is active then 
		// add the component
		addComponent(me.getX(), me.getY());
	      }
	    }
	  }
	
	  if (m_mode == CONNECTING) {
	    // turn off connecting points and remove connecting line
	    m_beanLayout.repaint();
	    Vector beanInstances = BeanInstance.getBeanInstances();
	    for (int i = 0; i < beanInstances.size(); i++) {
	      JComponent bean = 
		(JComponent)((BeanInstance)beanInstances.elementAt(i)).
		getBean();
	      if (bean instanceof Visible) {
		((Visible)bean).getVisual().setDisplayConnectors(false);
	      }
	    }

	    if (bi != null) {
	      boolean doConnection = false;
	      if (!(bi.getBean() instanceof BeanCommon)) {
		doConnection = true;
	      } else {
		// Give the target bean a chance to veto the proposed
		// connection
		if (((BeanCommon)bi.getBean()).
		    //connectionAllowed(m_sourceEventSetDescriptor.getName())) {
		    connectionAllowed(m_sourceEventSetDescriptor)) {
		  doConnection = true;
		}
	      }
	      if (doConnection) {
		// attempt to connect source and target beans

                if (bi.getBean() instanceof MetaBean) {
                  BeanConnection.doMetaConnection(m_editElement, bi,
                                                  m_sourceEventSetDescriptor,
                                                  m_beanLayout);
                } else {
                  BeanConnection bc = 
                    new BeanConnection(m_editElement, bi, 
                                       m_sourceEventSetDescriptor);
                }
	      }
	      m_beanLayout.repaint();
	    }
	    m_mode = NONE;
	    m_editElement = null;
	    m_sourceEventSetDescriptor = null;
	  }
	}
      }