Package jexer.menu

Class TSubMenu

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>

    public class TSubMenu
    extends TMenuItem
    TSubMenu is a special case menu item that wraps another TMenu.
    • Method Detail

      • onKeypress

        public void onKeypress​(TKeypressEvent keypress)
        Handle keystrokes.
        Overrides:
        onKeypress in class TMenuItem
        Parameters:
        keypress - keystroke event
      • draw

        public void draw()
        Draw the menu title.
        Overrides:
        draw in class TMenuItem
      • dispatch

        public void dispatch​(Backend backend)
        Override dispatch() to do nothing.
        Overrides:
        dispatch in class TMenuItem
        Parameters:
        backend - the backend that generated the user input
      • getActiveChild

        public TWidget getActiveChild()
        Returns my active widget.
        Overrides:
        getActiveChild in class TWidget
        Returns:
        widget that is active, or this if no children
      • addItem

        public TMenuItem addItem​(int id,
                                 java.lang.String label,
                                 TKeypress key)
        Convenience function to add a custom menu item.
        Parameters:
        id - menu item ID. Must be greater than 1024.
        label - menu item label
        key - global keyboard accelerator
        Returns:
        the new menu item
      • addItem

        public TMenuItem addItem​(int id,
                                 java.lang.String label,
                                 TKeypress key,
                                 boolean enabled)
        Convenience function to add a custom menu item.
        Parameters:
        id - menu item ID. Must be greater than 1024.
        label - menu item label
        key - global keyboard accelerator
        enabled - default state for enabled
        Returns:
        the new menu item
      • addItem

        public TMenuItem addItem​(int id,
                                 java.lang.String label)
        Convenience function to add a menu item.
        Parameters:
        id - menu item ID. Must be greater than 1024.
        label - menu item label
        Returns:
        the new menu item
      • addItem

        public TMenuItem addItem​(int id,
                                 java.lang.String label,
                                 boolean enabled)
        Convenience function to add a menu item.
        Parameters:
        id - menu item ID. Must be greater than 1024.
        label - menu item label
        enabled - default state for enabled
        Returns:
        the new menu item
      • addDefaultItem

        public TMenuItem addDefaultItem​(int id)
        Convenience function to add one of the default menu items.
        Parameters:
        id - menu item ID. Must be between 0 (inclusive) and 1023 (inclusive).
        Returns:
        the new menu item
      • addDefaultItem

        public TMenuItem addDefaultItem​(int id,
                                        boolean enabled)
        Convenience function to add one of the default menu items.
        Parameters:
        id - menu item ID. Must be between 0 (inclusive) and 1023 (inclusive).
        enabled - default state for enabled
        Returns:
        the new menu item
      • addSeparator

        public void addSeparator()
        Convenience function to add a menu separator.
      • addSubMenu

        public TSubMenu addSubMenu​(java.lang.String title)
        Convenience function to add a sub-menu.
        Parameters:
        title - menu title. Title must contain a keyboard shortcut, denoted by prefixing a letter with "&", e.g. "&File"
        Returns:
        the new sub-menu
      • sort

        public void sort()
        Sort the entries in this menu.
      • sort

        public void sort​(int cutoff)
        Sort the entries in this menu by label.
        Parameters:
        cutoff - any menu ID's less than this value will be placed first in the list, and stay in the previous order to each other