question: public static boolean addSeparatorIfNeeded ( JPopupMenu popupMenu ) { final int menuComponentCount = popupMenu . getComponentCount ( ) ; if ( menuComponentCount == 0 ) { return false ; } final Component lastMenuComponent = popupMenu . getComponent ( menuComponentCount - 1 ) ; if ( isPopupMenuSeparator ( lastMenuComponent ) ) { return false ; } popupMenu . addSeparator ( ) ; return true ; }
target:  Appends a separator to the end of the menu if it exists at least one non separator menu component immediately before and if there isn't, already, a separator at the end of the menu.