if ((menuItem.isSelected() && checkIcon == null) || (mod != null && mod.isArmed()) && (menuItem.getParent() instanceof MenuElement)) g.setColor(selectionBackground); else
  protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)  {    // Menu item is considered to be highlighted when it is selected.    // But we don't want to paint the background of JCheckBoxMenuItems    ButtonModel mod = menuItem.getModel();    if (menuItem.isContentAreaFilled())      {    if ((menuItem.isSelected() && checkIcon == null) || (mod != null &&         mod.isArmed())        && (menuItem.getParent() instanceof MenuElement))            g.setColor(selectionBackground);        else          g.setColor(bgColor);            g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight());          }      }