/** * Returns newly created menu. * * @param icon menu icon, can be either String icon name, ImageIcon, Image, image File or image * URL * @param text menu text * @param enabled whether menu is enabled or not * @param actionListener menu action listener * @return newly created menu */ protected WebMenu createSubMenu( final Object icon, final String text, final boolean enabled, final ActionListener actionListener) { final WebMenu menu = new WebMenu(); menu.setIcon(getIcon(icon)); menu.setLanguage(getLanguageKey(text)); menu.setEnabled(enabled); menu.addActionListener(actionListener); return menu; }
/** Adds separator into menu. */ public void addSeparator() { final E menuComponent = getMenu(); if (menuComponent instanceof WebMenu) { ((WebMenu) menuComponent).addSeparator(); } else if (menuComponent instanceof WebPopupMenu) { ((WebPopupMenu) menuComponent).addSeparator(); } }