private boolean isSynthIcon(Icon icon) {
   if (_synthIconMap == null) {
     _synthIconMap = new HashMap<String, Boolean>();
   }
   Class<?> aClass = icon.getClass();
   java.util.List<String> classNamesToPut = new ArrayList<String>();
   boolean isSynthIcon = false;
   while (aClass != null) {
     String name = aClass.getCanonicalName();
     if (name != null) {
       Boolean value = _synthIconMap.get(name);
       if (value != null) {
         return value;
       }
       classNamesToPut.add(name);
       if (isSynthIconClassName(name)) {
         isSynthIcon = true;
         break;
       }
     }
     aClass = aClass.getSuperclass();
   }
   for (String name : classNamesToPut) {
     _synthIconMap.put(name, isSynthIcon);
   }
   return isSynthIcon;
 }
  @Nullable
  private static Icon getAquaMenuInvertedIcon() {
    if (!UIUtil.isUnderAquaLookAndFeel()) return null;
    final Icon arrow = (Icon) UIManager.get("Menu.arrowIcon");
    if (arrow == null) return null;

    try {
      final Method method = ReflectionUtil.getMethod(arrow.getClass(), "getInvertedIcon");
      if (method != null) {
        return (Icon) method.invoke(arrow);
      }
      return null;
    } catch (InvocationTargetException e1) {
      return null;
    } catch (IllegalAccessException e1) {
      return null;
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.jvnet.flamingo.common.ui.BasicCommandButtonUI#paintButtonIcon(java
   * .awt.Graphics, java.awt.Rectangle)
   */
  @Override
  protected void paintButtonIcon(Graphics g, Rectangle iconRect) {
    JCommandButton jcb = (JCommandButton) this.commandButton;
    Icon regular = jcb.getIcon();
    if (toUseDisabledIcon()
        && (jcb.getDisabledIcon() != null)
        && ((regular != null) && !regular.getClass().isAnnotationPresent(TransitionAware.class)))
      regular = jcb.getDisabledIcon();

    if ((iconRect == null)
        || (regular == null)
        || (iconRect.width == 0)
        || (iconRect.height == 0)) {
      return;
    }

    boolean useThemed = SubstanceCoreUtilities.useThemedDefaultIcon(this.commandButton);
    if (regular != null) {
      Graphics2D g2d = (Graphics2D) g.create();

      GhostPaintingUtils.paintGhostIcon(g2d, jcb, regular, iconRect);
      g2d.setComposite(LafWidgetUtilities.getAlphaComposite(jcb, g));

      if (!useThemed) {
        regular.paintIcon(jcb, g2d, iconRect.x, iconRect.y);
      } else {
        StateTransitionTracker tracker =
            this.substanceVisualStateTracker.getActionStateTransitionTracker();
        ButtonModel model = commandButton.getActionModel();
        if (jcb.getCommandButtonKind() == CommandButtonKind.POPUP_ONLY) {
          tracker = this.substanceVisualStateTracker.getPopupStateTransitionTracker();
          model = jcb.getPopupModel();
        }
        CommandButtonBackgroundDelegate.paintThemedCommandButtonIcon(
            g2d, iconRect, jcb, regular, model, tracker);
      }
      g2d.dispose();
    }
  }