public class ActionListBox extends AbstractListBox
Interactable.FocusChangeDirection, Interactable.Result
Component.Alignment
Constructor and Description |
---|
ActionListBox() |
ActionListBox(TerminalSize preferredSize) |
Modifier and Type | Method and Description |
---|---|
void |
addAction(Action action)
Adds an action to the list, using toString() of the action as a label
|
void |
addAction(String label,
Action action)
Adds an action to the list, with a specified label
|
protected String |
createItemString(int index) |
TerminalPosition |
getHotspot()
When the component has keyboard focus, this method is called by the GUI
system to figure out where should the cursor be positioned.
|
protected Theme.Definition |
getListItemThemeDefinition(Theme theme) |
protected Theme.Definition |
getSelectedListItemThemeDefinition(Theme theme) |
protected Interactable.Result |
unhandledKeyboardEvent(Key key) |
addItem, afterEnteredFocus, calculatePreferredSize, clearItems, getHotSpotPositionOnLine, getItemAt, getNrOfItems, getSelectedIndex, getSelectedItem, getSize, indexOf, isScrollable, keyboardInteraction, printItem, repaint, setSelectedItem
afterLeftFocus, hasFocus, onEnterFocus, onLeaveFocus, setHotspot
addBorder, addComponentListener, getAlignment, getComponentListeners, getGUIScreen, getMinimumSize, getParent, getPreferredSize, getWindow, invalidate, isVisible, removeComponentListener, setAlignment, setParent, setPreferredSize, setVisible, transformAccordingToAlignment
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBorder, addComponentListener, getAlignment, getMinimumSize, getParent, getPreferredSize, getWindow, isVisible, removeComponentListener, setAlignment, setPreferredSize, setVisible
public ActionListBox()
public ActionListBox(TerminalSize preferredSize)
public void addAction(Action action)
action
- Action to be performed when the user presses enter keypublic void addAction(String label, Action action)
label
- Label to be displayed, representing the actionaction
- Action to be performed when the user presses enter keyprotected Interactable.Result unhandledKeyboardEvent(Key key)
unhandledKeyboardEvent
in class AbstractListBox
protected String createItemString(int index)
createItemString
in class AbstractListBox
public TerminalPosition getHotspot()
Interactable
getHotspot
in interface Interactable
getHotspot
in class AbstractInteractableComponent
null
if the cursor should
be hiddenprotected Theme.Definition getListItemThemeDefinition(Theme theme)
getListItemThemeDefinition
in class AbstractListBox
protected Theme.Definition getSelectedListItemThemeDefinition(Theme theme)
getSelectedListItemThemeDefinition
in class AbstractListBox
Copyright © 2015. All Rights Reserved.