private static Method getMethod(Object object, String methodName) throws NoSuchMethodException
    {
        Method[] methods = object.getClass().getMethods();
        
        for (int i = 0; i < methods.length; i++)
        {
            if (methods[i].getName().equals(methodName) && 
                    methods[i].getParameterTypes().length == 1 &&
                    methods[i].getParameterTypes()[0] == ButtonListener.class)
            {
                return methods[i];
            }
        }
        
        int fewestArgsIndex = -1;
        for (int i = 0; i < methods.length; i++)
        {
            if (methods[i].getName().equals(methodName) && 
                    (fewestArgsIndex == -1 || methods[i].getParameterTypes().length < 
                    methods[fewestArgsIndex].getParameterTypes().length))
            {
                fewestArgsIndex = i;
            }
        }
        
        if (fewestArgsIndex == -1)
        {
            throw new NoSuchMethodException(object.getClass().getName() + 
                    " does not support a method named " + methodName);
        }
        
        return methods[fewestArgsIndex];
    }