Java JMenu addSeparator(JMenu menu)

Here you can find the source of addSeparator(JMenu menu)

Description

add Separator

License

Open Source License

Declaration

public static void addSeparator(JMenu menu) 

Method Source Code


//package com.java2s;
import javax.swing.*;

public class Main {
    public static void addSeparator(JMenu menu) {
        if (menu.getComponentCount() > 0)
            menu.add(new JSeparator());
    }/*from   ww w . j  a  va  2s .  c  o m*/
}

Related

  1. addMenuItem(JMenu menu, String label, Action action, int mnemonic, String tooltip, boolean isEnabled)
  2. addMenuItem(JMenu menu, String label, Action action, int mnemonic, String tooltip, boolean isEnabled)
  3. addMenuItem(Window window, JMenu menu, String title, String icon, int mnemonic, KeyStroke key, ActionListener listener)
  4. addMenuItems(JMenu menu, JComponent... items)
  5. addRadioButtonMenuItem(ActionListener al, JMenu m, String label, String command, boolean b, ButtonGroup g)
  6. addSeparatorIfNeeded(JMenu menu)
  7. applyDefaultProperties(final JMenu comp)
  8. assignMnemonics(JMenu menu)
  9. changeMenuItemsState(final JMenu menu, final boolean enableState)