public abstract class AbstractListBox extends AbstractInteractableComponent
Interactable.FocusChangeDirection, Interactable.Result
Component.Alignment
Constructor and Description |
---|
AbstractListBox() |
AbstractListBox(TerminalSize preferredSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
addItem(Object item) |
protected void |
afterEnteredFocus(Interactable.FocusChangeDirection direction) |
protected TerminalSize |
calculatePreferredSize() |
void |
clearItems() |
protected abstract String |
createItemString(int index) |
protected int |
getHotSpotPositionOnLine(int selectedIndex) |
Object |
getItemAt(int index) |
protected Theme.Definition |
getListItemThemeDefinition(Theme theme) |
int |
getNrOfItems() |
int |
getSelectedIndex() |
Object |
getSelectedItem() |
protected Theme.Definition |
getSelectedListItemThemeDefinition(Theme theme) |
int |
getSize() |
int |
indexOf(Object item) |
boolean |
isScrollable()
This method is used by the layout system when it needs to shrink components
because the available space is too small.
|
Interactable.Result |
keyboardInteraction(Key key)
This method is called when this component has focus and the user has
pressed a key on the keyboard.
|
protected void |
printItem(TextGraphics graphics,
int x,
int y,
int index)
Draws an item in the ListBox at specific coordinates.
|
void |
repaint(TextGraphics graphics)
This is the main 'paint' method for a component, it's called when
lanterna wants the component to re-draw itself.
|
void |
setSelectedItem(int index) |
protected Interactable.Result |
unhandledKeyboardEvent(Key key) |
afterLeftFocus, getHotspot, 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 AbstractListBox()
public AbstractListBox(TerminalSize preferredSize)
protected TerminalSize calculatePreferredSize()
calculatePreferredSize
in class AbstractComponent
protected void addItem(Object item)
public void clearItems()
public int indexOf(Object item)
public int getSize()
public Object getItemAt(int index)
public int getNrOfItems()
public void setSelectedItem(int index)
public int getSelectedIndex()
public Object getSelectedItem()
public boolean isScrollable()
Component
isScrollable
in interface Component
isScrollable
in class AbstractComponent
public void repaint(TextGraphics graphics)
Component
graphics
- TextGraphics object to use for drawing the component and
getting information about the drawing contextprotected void afterEnteredFocus(Interactable.FocusChangeDirection direction)
afterEnteredFocus
in class AbstractInteractableComponent
protected Theme.Definition getSelectedListItemThemeDefinition(Theme theme)
protected Theme.Definition getListItemThemeDefinition(Theme theme)
public Interactable.Result keyboardInteraction(Key key)
Interactable
key
- Key pressed on the keyboardprotected void printItem(TextGraphics graphics, int x, int y, int index)
graphics
- TextGraphics object to use when drawing the itemx
- X-coordinate on the terminal of the item, pre-adjusted for scrollingy
- Y-coordinate on the terminal of the item, pre-adjusted for scrollingindex
- Index of the item that is to be drawnprotected Interactable.Result unhandledKeyboardEvent(Key key)
protected int getHotSpotPositionOnLine(int selectedIndex)
protected abstract String createItemString(int index)
Copyright © 2015. All Rights Reserved.