Class Menu

java.lang.Object
pt.tecnico.uilib.menus.Menu

public class Menu extends Object
Class Menu manages a list of commands.
  • Constructor Details

    • Menu

      public Menu(Dialog ui, String title, Command<?>... commands)
      Parameters:
      ui - interaction for the menu.
      title - menu title.
      commands - list of commands managed by the menu.
    • Menu

      public Menu(String title, Command<?>... commands)
      Parameters:
      title - menu title.
      commands - list of commands managed by the menu.
  • Method Details

    • title

      public String title()
      Returns:
      the menu title.
    • size

      public int size()
      Returns:
      the number of commands.
    • entry

      public Command<?> entry(int n)
      Parameters:
      n - the command number (not the index) in the menu
      Returns:
      the n-th command.
    • entries

      public Command<?>[] entries()
      Returns:
      the commands (package).
    • open

      public void open()
      The menu interacts with the user and executes the appropriate commands.