Class MenuListDialogBuilder


  • public class MenuListDialogBuilder
    extends com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<MenuListDialogBuilder,​MenuListDialog>
    Dialog builder for the MenuListDialog class, use this to create instances of that class and to customize them
    Author:
    Martin
    • Constructor Detail

      • MenuListDialogBuilder

        public MenuListDialogBuilder()
        Default constructor
    • Method Detail

      • setListBoxSize

        public MenuListDialogBuilder setListBoxSize​(com.googlecode.lanterna.TerminalSize listBoxSize)
        Sets the size of the internal MenuListBox in columns and rows, forcing scrollbars to appear if the space isn't big enough to contain all the items
        Parameters:
        listBoxSize - Size of the MenuListBox
        Returns:
        Itself
      • getListBoxSize

        public com.googlecode.lanterna.TerminalSize getListBoxSize()
        Returns the specified size of the internal MenuListBox or null if there is no size and the list box will attempt to take up enough size to draw all items
        Returns:
        Specified size of the internal MenuListBox or null if there is no size
      • addAction

        public MenuListDialogBuilder addAction​(String label,
                                               Runnable action)
        Adds an additional action to the MenuListBox that is to be displayed when the dialog is opened
        Parameters:
        label - Label of the new action
        action - Action to perform if the user selects this item
        Returns:
        Itself
      • addAction

        public MenuListDialogBuilder addAction​(Runnable action)
        Adds an additional action to the MenuListBox that is to be displayed when the dialog is opened. The label of this item will be derived by calling toString() on the runnable
        Parameters:
        action - Action to perform if the user selects this item
        Returns:
        Itself
      • addActions

        public MenuListDialogBuilder addActions​(Runnable... actions)
        Adds additional actions to the MenuListBox that is to be displayed when the dialog is opened. The label of the items will be derived by calling toString() on each runnable
        Parameters:
        actions - Items to add to the MenuListBox
        Returns:
        Itself
      • getActions

        public List<Runnable> getActions()
        Returns a copy of the internal list of actions currently inside this builder that will be assigned to the MenuListBox in the dialog when built
        Returns:
        Copy of the internal list of actions currently inside this builder