Java JPopupMenu addSeparatorIfNecessary(JPopupMenu popup)

Here you can find the source of addSeparatorIfNecessary(JPopupMenu popup)

Description

add Separator If Necessary

License

Open Source License

Declaration

public static void addSeparatorIfNecessary(JPopupMenu popup)
        

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JPopupMenu;

import javax.swing.JSeparator;

public class Main {
    public static void addSeparatorIfNecessary(JPopupMenu popup)
    /*      */{//from  ww w.  j  a v a2s  .c  om
        /* 3637 */int count = popup.getComponentCount();
        /* 3638 */if ((count > 0)
                && (!(popup.getComponent(count - 1) instanceof JSeparator)))
            /* 3639 */popup.addSeparator();
        /*      */}
}

Related

  1. addOption(JPopupMenu popupMenu, String text, String key, ActionListener actionListener)
  2. addPopup(Component component, final JPopupMenu popup)
  3. addPopup(Component component, final JPopupMenu popup)
  4. addPopup(final Component c, final JPopupMenu m)
  5. addSeparatorIfNecessary(JPopupMenu popup)
  6. addSeparatorIfNeeded(JPopupMenu popupMenu)
  7. applyDefaultProperties(final JPopupMenu comp)
  8. attachPopupMenu(final JComponent component, final JPopupMenu popupMenu)
  9. cleanPopupLayoutMetrics(JPopupMenu popupMenu)