public static void removeAllSeparators(JPopupMenu popupMenu){
  for (int i=0; i < popupMenu.getComponentCount(); i++) {
    if (isPopupMenuSeparator(popupMenu.getComponent(i))) {
      popupMenu.remove(i);
      i--;
    }
  }
}

public static void removeAllSeparators ( JPopupMenu popupMenu ) { for ( int i = 0 ; i < popupMenu . getComponentCount ( ) ; i ++ ) { if ( isPopupMenuSeparator ( popupMenu . getComponent ( i ) ) ) { popupMenu . remove ( i ) ; i -- ; } } }
removes all separators from the given pop up menu .
