ui/src/main/java/ucar/nc2/ui/util/SwingUtils.java
public static <T extends JComponent> Class getJClass(T component) {
      Class<?> clazz = component.getClass();
      while (!clazz.getName().matches("javax.swing.J[^.]*$")) {
         clazz = clazz.getSuperclass();
      }
      return clazz;
   }
public static <T extends JComponent> Class getJClass(T component) {
      Class<?> clazz = component.getClass();
      while (!clazz.getName().matches("javax.swing.J[^.]*$")) {
         clazz = clazz.getSuperclass();
      }
      return clazz;
   }
Convenience method to obtain the Swing class from which this
component was directly or indirectly derived.

@param component The component whose Swing superclass is to be
determined
@return The nearest Swing class in the inheritance tree