Package jexer.menu

Class TMenuItem

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>
    Direct Known Subclasses:
    TMenuSeparator, TSubMenu

    public class TMenuItem
    extends TWidget
    TMenuItem implements a menu item.
    • Method Detail

      • onMouseUp

        public void onMouseUp​(TMouseEvent mouse)
        Handle mouse button releases.
        Overrides:
        onMouseUp in class TWidget
        Parameters:
        mouse - mouse button release event
      • onKeypress

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

        public void draw()
        Draw a menu item with label.
        Overrides:
        draw in class TWidget
      • getId

        public final int getId()
        Get the menu item ID.
        Returns:
        the id
      • setCheckable

        public final void setCheckable​(boolean checkable)
        Set checkable flag.
        Parameters:
        checkable - if true, this menu item can be checked/unchecked
      • getChecked

        public final boolean getChecked()
        Get checkable flag.
        Returns:
        true if this menu item is both checkable and checked
      • setChecked

        public final void setChecked​(boolean checked)
        Set checked flag. Note that setting checked on an item checkable will do nothing.
        Parameters:
        checked - if true, and if this menu item is checkable, then getChecked() will return true
      • getMnemonic

        public final MnemonicString getMnemonic()
        Get the mnemonic string for this menu item.
        Returns:
        mnemonic string
      • getKey

        public final TKeypress getKey()
        Get a global accelerator key for this menu item.
        Returns:
        global keyboard accelerator, or null if no key is associated with this item
      • setKey

        public final void setKey​(TKeypress key)
        Set a global accelerator key for this menu item.
        Parameters:
        key - global keyboard accelerator
      • getIcon

        public final int getIcon()
        Get a picture/emoji icon for this menu item.
        Returns:
        the codepoint, or -1 if no icon is specified for this menu item
      • setIcon

        public final void setIcon​(int icon)
        Set a picture/emoji icon for this menu item.
        Parameters:
        icon - a codepoint, or -1 to unset the icon
      • dispatch

        public void dispatch​(Backend backend)
        Dispatch event(s) due to selection or click.
        Parameters:
        backend - the backend that generated the user input