Package jexer.menu
Class TSubMenu
- java.lang.Object
-
- jexer.TWidget
-
- jexer.menu.TMenuItem
-
- jexer.menu.TSubMenu
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TMenuItem
addDefaultItem(int id)
Convenience function to add one of the default menu items.TMenuItem
addDefaultItem(int id, boolean enabled)
Convenience function to add one of the default menu items.TMenuItem
addItem(int id, java.lang.String label)
Convenience function to add a menu item.TMenuItem
addItem(int id, java.lang.String label, boolean enabled)
Convenience function to add a menu item.TMenuItem
addItem(int id, java.lang.String label, TKeypress key)
Convenience function to add a custom menu item.TMenuItem
addItem(int id, java.lang.String label, TKeypress key, boolean enabled)
Convenience function to add a custom menu item.void
addSeparator()
Convenience function to add a menu separator.TSubMenu
addSubMenu(java.lang.String title)
Convenience function to add a sub-menu.void
dispatch(Backend backend)
Override dispatch() to do nothing.void
draw()
Draw the menu title.TWidget
getActiveChild()
Returns my active widget.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
sort()
Sort the entries in this menu.void
sort(int cutoff)
Sort the entries in this menu by label.-
Methods inherited from class jexer.menu.TMenuItem
getChecked, getIcon, getId, getKey, getMnemonic, onMouseUp, setCheckable, setChecked, setIcon, setKey
-
Methods inherited from class jexer.TWidget
activate, activate, activate, activateAll, addButton, addCalendar, addCheckBox, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, close, compareTo, doRepaint, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getApplication, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getCustomMousePointer, getHeight, getLayoutManager, getMouseStyle, getParent, getScreen, getTheme, getWidgetUnderMouse, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isPixelMouse, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onMenu, onMouseDoubleClick, onMouseDown, onMouseMotion, onResize, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setCustomMousePointer, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setHeight, setLayoutManager, setMouseStyle, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY
-
-
-
-
Method Detail
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTMenuItem
- Parameters:
keypress
- keystroke event
-
dispatch
public void dispatch(Backend backend)
Override dispatch() to do nothing.
-
getActiveChild
public TWidget getActiveChild()
Returns my active widget.- Overrides:
getActiveChild
in classTWidget
- 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 labelkey
- 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 labelkey
- global keyboard acceleratorenabled
- 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 labelenabled
- 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
-
-