Class Menu<T extends Menu<T>>


public class Menu<T extends Menu<T>> extends StyledElement<T>
Represents an HTML <menu> element.

The <menu> element is a semantic alternative to <ul> for representing a list of commands or interactive options. In modern HTML it renders identically to an unordered list, but provides semantic meaning indicating the list represents actions rather than generic content.

Usage:


 Menu menu = new Menu();
 menu.addListItem("Cut");
 menu.addListItem("Copy");
 menu.addListItem("Paste");
 
Since:
2007
Version:
2.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Menu

      public Menu()
      Constructs an empty <menu> element.
  • Method Details

    • setLabel

      public final T setLabel(String label)
      Sets the label for this menu.

      The label provides a visible name for the menu, typically displayed when the menu is used as a submenu within a larger structure.

      Parameters:
      label - the visible label text for the menu
    • addListItem

      public void addListItem(Li item)
      Adds a list item to this menu.
      Parameters:
      item - the Li element to add
    • addListItem

      public Li addListItem(String text)
      Adds a list item with the specified text to this menu.
      Parameters:
      text - the text for the list item
      Returns:
      the created Li element
    • removeAllElements

      public void removeAllElements()
      Removes all list items from this menu.
      Overrides:
      removeAllElements in class Element<T extends Menu<T>>