Skip to main content

Class JtvMenu

public class JtvMenu

Represents one level of a menu tree.

JtvMenu holds the item list of JtvMenuItem records that form a single menu level — either the top-level menu bar or one drop-down submenu. A JtvMenuView (and its concrete descendants JtvMenuBar and JtvMenuBox) owns a TMenu and iterates over items to render and process the menu.

defaultItem remembers the last item that was focused so that reopening the menu restores the previous position. It is updated by JtvMenuView.execute() after the user dismisses the menu.

TMenu objects are typically constructed by helper code (e.g. application initMenuBar) and passed to a JtvMenuBar or JtvMenuBox constructor.

org.viktor44.jtvision.menus.JtvMenu

Summary​

Constructors​

VisibilitySignature
publicJtvMenu()
publicJtvMenu(JtvMenuItem items)

Fields​

ModifiersField nameType
privateitemsList<org.viktor44.jtvision.menus.JtvMenuItem>
privatedefaultItemorg.viktor44.jtvision.menus.JtvMenuItem

Methods​

ModifiersMethod signatureReturn type
publicaddItem(JtvMenuItem item)org.viktor44.jtvision.menus.JtvMenu
publicaddSeparator()org.viktor44.jtvision.menus.JtvMenu
publicgetItems()List<org.viktor44.jtvision.menus.JtvMenuItem>
publicgetDefaultItem()org.viktor44.jtvision.menus.JtvMenuItem
publicsetDefaultItem(JtvMenuItem defaultItem)void

Constructors​

JtvMenu()​

Constructs an empty menu with no items and no default.

JtvMenu(JtvMenuItem items)​

Constructs a menu and adds aItems (and any chained items). The default item is set to the first inserted item.

Parameters

  • items - the first JtvMenuItem to add

Fields​

List<org.viktor44.jtvision.menus.JtvMenuItem> items​

The ordered list of items in this menu.

org.viktor44.jtvision.menus.JtvMenuItem defaultItem​

Pointer to the default (last focused) item in the list. Used to restore the highlighted position when the menu is re-opened. Initially set to items and updated by JtvMenuView.execute() after each interaction.

Methods​

addItem(JtvMenuItem item)​

No method description provided

Parameters

  • item

addSeparator()​

No method description provided

getItems()​

The ordered list of items in this menu.

getDefaultItem()​

Pointer to the default (last focused) item in the list. Used to restore the highlighted position when the menu is re-opened. Initially set to items and updated by JtvMenuView.execute() after each interaction.

setDefaultItem(JtvMenuItem defaultItem)​

Pointer to the default (last focused) item in the list. Used to restore the highlighted position when the menu is re-opened. Initially set to items and updated by JtvMenuView.execute() after each interaction.

Parameters

  • defaultItem