code: public static void removeAllSeparators(JPopupMenu popupMenu) {
          for (int i = 0; i < popupMenu.getComponentCount(); i++) {
              if (isPopupMenuSeparator(popupMenu.getComponent(i))) {
                  popupMenu.remove(i);
                  i--;
              }
          }
      }
docs: Removes all separators from the given pop up menu.
  
  @param popupMenu the pop up menu whose separators will be removed
  @see javax.swing.JPopupMenu.Separator