Class FreeMenuPiece


@ClientOnly public class FreeMenuPiece extends BaseMenuPiece
A MenuPiece that does not add any children by itself. All items have to be added or removed directly by the client.
Author:
Benjamin Sigg
  • Constructor Details

    • FreeMenuPiece

      public FreeMenuPiece()
  • Method Details

    • getItemCount

      public int getItemCount()
      Description copied from class: MenuPiece
      Gets the number of items this MenuPiece added to its menu.
      Overrides:
      getItemCount in class BaseMenuPiece
      Returns:
      the number of items
    • getItem

      public Component getItem(int index)
      Description copied from class: BaseMenuPiece
      Gets the index'th item of this piece.
      Overrides:
      getItem in class BaseMenuPiece
      Parameters:
      index - the location of the item
      Returns:
      the item
    • add

      public void add(Component item)
      Description copied from class: BaseMenuPiece
      Adds item at the end of this piece.
      Overrides:
      add in class BaseMenuPiece
      Parameters:
      item - the item to add.
    • addSeparator

      public void addSeparator()
      Description copied from class: BaseMenuPiece
      Adds a separator at the end of this piece.
      Overrides:
      addSeparator in class BaseMenuPiece
    • insert

      public void insert(int index, Component item)
      Description copied from class: BaseMenuPiece
      Inserts a new item into the menu.
      Overrides:
      insert in class BaseMenuPiece
      Parameters:
      index - the location of the new item, measured in the coordinate space of this piece.
      item - the new item.
    • insertSeparator

      public void insertSeparator(int index)
      Description copied from class: BaseMenuPiece
      Inserts a separator into this piece.
      Overrides:
      insertSeparator in class BaseMenuPiece
      Parameters:
      index - the location of the separator
    • remove

      public void remove(int index)
      Description copied from class: BaseMenuPiece
      Removes the index'th item of this piece.
      Overrides:
      remove in class BaseMenuPiece
      Parameters:
      index - the location of the item to remove.
    • remove

      public void remove(Component item)
      Description copied from class: BaseMenuPiece
      Removes item from the menu.
      Overrides:
      remove in class BaseMenuPiece
      Parameters:
      item - the item to remove