code: public static Object getUIOfType(ComponentUI ui, Class klass) {
          if (klass.isInstance(ui)) {
              return ui;
          }
  
          return null;
      }
docs: Returns the ui that is of type <code>klass</code>, or null if one can not
  be found.
  
  @param  ui    the UI delegate to be tested.
  @param  klass the class to test against.
  
  @return {@code ui} if {@code klass} is an instance of {@code ui},
  {@code null} otherwise.