private static <T extends JComponent> T getComponentFromList(Class<T> clazz,
         List<T> list, String property, Object value)
         throws IllegalArgumentException {
      T retVal = null;
      Method method = null;
      try {
         method = clazz.getMethod("get" + property);
      } catch (NoSuchMethodException ex) {
         try {
            method = clazz.getMethod("is" + property);
         } catch (NoSuchMethodException ex1) {
            throw new IllegalArgumentException("Property " + property +
                  " not found in class " + clazz.getName());
         }
      }
      try {
         for (T t : list) {
            Object testVal = method.invoke(t);
            if (equals(value, testVal)) {
               return t;
            }
         }
      } catch (InvocationTargetException ex) {
         throw new IllegalArgumentException(
               "Error accessing property " + property +
               " in class " + clazz.getName());
      } catch (IllegalAccessException ex) {
         throw new IllegalArgumentException(
               "Property " + property +
               " cannot be accessed in class " + clazz.getName());
      } catch (SecurityException ex) {
         throw new IllegalArgumentException(
               "Property " + property +
               " cannot be accessed in class " + clazz.getName());
      }
      return retVal;
   }