protected static int countActionListeners(Component comp) {
		try {
			Class actionListenerClass = Class.forName("java.awt.event.ActionListener");
			Class[] types = { Class.forName("java.lang.Class") };
			Method getListeners = comp.getClass().getMethod("getListeners", types);
			Object[] args = { actionListenerClass };
			EventListener[] listeners = (EventListener []) getListeners.invoke(comp, args);
			return listeners.length;
		} catch (Exception ex) {
			return -1;
		}
	}