Package app.ui.widgets
Class WidgetTextBox
java.lang.Object
app.ui.widgets.Widget
app.ui.widgets.WidgetTextBox
- All Implemented Interfaces:
IDrawable,ISelectable,ITextInput
- Direct Known Subclasses:
WidgetPasswordBox
WidgetTextBox represents a text input field in a user interface.
It allows for text input and display, and can be selected or unselected.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionWidgetTextBox(int x, int y, int len, String text) Constructs a WidgetTextBox with default text alignment to the left.WidgetTextBox(int x, int y, int len, String text, TEXT_ALIGNMENT textAlignment) Constructs a WidgetTextBox with specified text alignment. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(char[][] buffer, com.googlecode.lanterna.TextColor[][] printColor, com.googlecode.lanterna.TextColor[][] backColor) draws the widget to the buffer.voiddrawSelection(char[][] buffer, com.googlecode.lanterna.TextColor[][] printColor, com.googlecode.lanterna.TextColor[][] backColor) Constructs a WidgetTextBox with default text alignment to the left.voidkeyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke) keyStroke processes a key stroke.voidselect()Selects the widget.voidunselect()Unselects the widget.Methods inherited from class app.ui.widgets.Widget
drawText, getLen, getSelected, getSkipSelection, getText, getWidgetID, getX, getY, isHide, setHide, setSkipSelection, setText, setWidgetID
-
Constructor Details
-
WidgetTextBox
Constructs a WidgetTextBox with default text alignment to the left.- Parameters:
x- The x-coordinate of the widget.y- The y-coordinate of the widget.len- The length of the widget.text- The initial text of the widget.
-
WidgetTextBox
Constructs a WidgetTextBox with specified text alignment.- Parameters:
x- The x-coordinate of the widget.y- The y-coordinate of the widget.len- The length of the widget.text- The initial text of the widget.textAlignment- The alignment of the text within the widget.
-
-
Method Details
-
drawSelection
public void drawSelection(char[][] buffer, com.googlecode.lanterna.TextColor[][] printColor, com.googlecode.lanterna.TextColor[][] backColor) Constructs a WidgetTextBox with default text alignment to the left.- Specified by:
drawSelectionin interfaceISelectable- Parameters:
buffer- The buffer to draw the widget to.printColor- The color of the text.backColor- The color of the background.
-
select
public void select()Selects the widget.- Specified by:
selectin interfaceISelectable
-
unselect
public void unselect()Unselects the widget.- Specified by:
unselectin interfaceISelectable
-
draw
public void draw(char[][] buffer, com.googlecode.lanterna.TextColor[][] printColor, com.googlecode.lanterna.TextColor[][] backColor) draws the widget to the buffer. -
keyStroke
public void keyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke) keyStroke processes a key stroke.- Specified by:
keyStrokein interfaceITextInput- Parameters:
keyStroke- The key stroke to process.
-