ui/src/main/java/ucar/nc2/ui/util/SwingUtils.java
public static Map<Object, Object> getProperties(JComponent component) {
      Map<Object, Object> retVal = new HashMap<Object, Object>();
      Class<?> clazz = component.getClass();
      Method[] methods = clazz.getMethods();
      Object value = null;
      for (Method method : methods) {
         if (method.getName().matches("^(is|get).*") &&
               method.getParameterTypes().length == 0) {
            try {
               Class returnType = method.getReturnType();
               if (returnType != void.class &&
                     !returnType.getName().startsWith("[") &&
                     !setExclude.contains(method.getName())) {
                  String key = method.getName();
                  value = method.invoke(component);
                  if (value != null && !(value instanceof Component)) {
                     retVal.put(key, value);
                  }
               }
            // ignore exceptions that arise if the property could not be accessed
            } catch (IllegalAccessException ex) {
            } catch (IllegalArgumentException ex) {
            } catch (InvocationTargetException ex) {
            }
         }
      }
      return retVal;
   }
public static Map<Object, Object> getProperties(JComponent component) {
      Map<Object, Object> retVal = new HashMap<Object, Object>();
      Class<?> clazz = component.getClass();
      Method[] methods = clazz.getMethods();
      Object value = null;
      for (Method method : methods) {
         if (method.getName().matches("^(is|get).*") &&
               method.getParameterTypes().length == 0) {
            try {
               Class returnType = method.getReturnType();
               if (returnType != void.class &&
                     !returnType.getName().startsWith("[") &&
                     !setExclude.contains(method.getName())) {
                  String key = method.getName();
                  value = method.invoke(component);
                  if (value != null && !(value instanceof Component)) {
                     retVal.put(key, value);
                  }
               }
            // ignore exceptions that arise if the property could not be accessed
            } catch (IllegalAccessException ex) {
            } catch (IllegalArgumentException ex) {
            } catch (InvocationTargetException ex) {
            }
         }
      }
      return retVal;
   }
public static Map < Object , Object > getProperties ( JComponent component ) { Map < Object , Object > retVal = new HashMap < Object , Object > ( ) ; Class < ? > clazz = component . getClass ( ) ; Method [ ] methods = clazz . getMethods ( ) ; Object value = null ; for ( Method method : methods ) { if ( method . getName ( ) . matches ( "^(is|get).*" ) && method . getParameterTypes ( ) . length == 0 ) { try { Class returnType = method . getReturnType ( ) ; if ( returnType != void . class && ! returnType . getName ( ) . startsWith ( "[" ) && ! setExclude . contains ( method . getName ( ) ) ) { String key = method . getName ( ) ; value = method . invoke ( component ) ; if ( value != null && ! ( value instanceof Component ) ) { retVal . put ( key , value ) ; } } // ignore exceptions that arise if the property could not be accessed } catch ( IllegalAccessException ex ) { } catch ( IllegalArgumentException ex ) { } catch ( InvocationTargetException ex ) { } } } return retVal ; }
Convenience method for obtaining most non-null human readable properties
of a JComponent.  Array properties are not included.
<P>
Implementation note:  The returned value is a HashMap.  This is subject
to change, so callers should code against the interface Map.

@param component the component whose proerties are to be determined
@return the class and value of the properties
Convenience method for obtaining most non - null human readable properties of a JComponent . Array properties are not included . <P > Implementation note : The returned value is a HashMap . This is subject to change so callers should code against the interface Map .