public interface Interactable extends Component
AbstractInteractableComponent
instead of implementing this one directly.AbstractInteractableComponent
Modifier and Type | Interface and Description |
---|---|
static class |
Interactable.FocusChangeDirection
When focus has changed, which direction.
|
static class |
Interactable.Result
Enum to represent the various results coming out of the handleKeyStroke method
|
Modifier and Type | Method and Description |
---|---|
TerminalPosition |
getCursorLocation()
Returns, in local coordinates, where to put the cursor on the screen when this component has focus.
|
InputFilter |
getInputFilter()
Returns the input filter currently assigned to the interactable component.
|
Interactable.Result |
handleInput(KeyStroke keyStroke)
Accepts a KeyStroke as input and processes this as a user input.
|
boolean |
isFocused()
Returns
true if this component currently has input focus in its root container. |
void |
onEnterFocus(Interactable.FocusChangeDirection direction,
Interactable previouslyInFocus)
Method called when this component gained keyboard focus.
|
void |
onLeaveFocus(Interactable.FocusChangeDirection direction,
Interactable nextInFocus)
Method called when keyboard focus moves away from this component
|
Interactable |
setInputFilter(InputFilter inputFilter)
Assigns an input filter to the interactable component.
|
Interactable |
takeFocus()
Moves focus in the
BasePane to this component. |
addTo, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getSize, getTextGUI, hasParent, invalidate, isInside, onAdded, onRemoved, setLayoutData, setPosition, setPreferredSize, setSize, toBasePane, toGlobal, withBorder
draw, isInvalid
TerminalPosition getCursorLocation()
Interactable.Result handleInput(KeyStroke keyStroke)
Result.UNHANDLED
should be returned. This will tell the GUI system that
the key stroke was not understood by this component and may be dealt with in another way. If event was processed
properly, it should return Result.HANDLED
, which will make the GUI system stop processing this particular
key-stroke. Furthermore, if the component understood the key-stroke and would like to move focus to a different
component, there are the Result.MOVE_FOCUS_*
values. This method should be invoking the input filter, if
it is set, to see if the input should be processed or not.keyStroke
- What input was entered by the userInteractable takeFocus()
BasePane
to this component. If the component has not been added to a BasePane
(i.e. a Window
most of the time), does nothing.void onEnterFocus(Interactable.FocusChangeDirection direction, Interactable previouslyInFocus)
direction
- What direction did the focus come frompreviouslyInFocus
- Which component had focus previously (null
if none)void onLeaveFocus(Interactable.FocusChangeDirection direction, Interactable nextInFocus)
direction
- What direction is focus going innextInFocus
- Which component is receiving focus next (or null
if none)boolean isFocused()
true
if this component currently has input focus in its root container.true
if the interactable has input focus, false
otherwiseInteractable setInputFilter(InputFilter inputFilter)
null
means there is no filter.inputFilter
- Input filter to assign to the interactableInputFilter getInputFilter()
null
means there is no filter.Copyright © 2016. All rights reserved.