public class Button extends AbstractInteractableComponent
Interactable.FocusChangeDirection, Interactable.Result
Component.Alignment
Constructor and Description |
---|
Button(String text) |
Button(String text,
Action onPressEvent) |
Modifier and Type | Method and Description |
---|---|
void |
afterEnteredFocus(Interactable.FocusChangeDirection direction) |
void |
afterLeftFocus(Interactable.FocusChangeDirection direction) |
protected TerminalSize |
calculatePreferredSize() |
String |
getText() |
Interactable.Result |
keyboardInteraction(Key key)
This method is called when this component has focus and the user has
pressed a key on the keyboard.
|
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 |
setText(String text) |
getHotspot, hasFocus, onEnterFocus, onLeaveFocus, setHotspot
addBorder, addComponentListener, getAlignment, getComponentListeners, getGUIScreen, getMinimumSize, getParent, getPreferredSize, getWindow, invalidate, isScrollable, 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, isScrollable, isVisible, removeComponentListener, setAlignment, setPreferredSize, setVisible
public Button(String text)
public void repaint(TextGraphics graphics)
Component
graphics
- TextGraphics object to use for drawing the component and
getting information about the drawing contextpublic void setText(String text)
public String getText()
protected TerminalSize calculatePreferredSize()
calculatePreferredSize
in class AbstractComponent
public void afterEnteredFocus(Interactable.FocusChangeDirection direction)
afterEnteredFocus
in class AbstractInteractableComponent
public void afterLeftFocus(Interactable.FocusChangeDirection direction)
afterLeftFocus
in class AbstractInteractableComponent
public Interactable.Result keyboardInteraction(Key key)
Interactable
key
- Key pressed on the keyboardCopyright © 2015. All Rights Reserved.