java.lang.Object
it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
it.polimi.ingsw.view.cli.console.graphics.components.ActiveItem
it.polimi.ingsw.view.cli.console.graphics.components.TextBox
- All Implemented Interfaces:
Toggleable
,KeyEventListener
public class TextBox extends ActiveItem
A field to be filled with text by the user
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
activeItems, id, parent, passiveItems
-
Constructor Summary
Constructors Constructor Description TextBox(InputDialog parent, CursorPosition initCoord, int width, int height, java.lang.String label)
Custom constructorTextBox(InputDialog parent, CursorPosition initCoord, java.lang.String label)
Default constructor -
Method Summary
Modifier and Type Method Description void
onRelease()
Hides the textBox shadows, saving an eventual inputvoid
onSelect()
Shows the textBox shadows, placing the cursor at its beginning and removing its previous inputvoid
show()
Draws the textBox on the screen, drawing its background, borders and labelMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.ActiveItem
enable, getBackgroundColor, onDisable
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getCli, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem, remove
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getColor, getHeight, getInitCoord, getTextColor, getWidth, hideBorders, loadPropertiesFile
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.polimi.ingsw.view.cli.console.KeyEventListener
onArrowDown, onArrowLeft, onArrowRight, onArrowUp, onBackspace, onCarriageReturn, onPrintableKey, onTab
-
Constructor Details
-
TextBox
Default constructorCreates a new textBox inside a window, using default properties
- Parameters:
parent
- the textBox containerinitCoord
- the textBox initial position relative to its containerlabel
- the textBox label
-
TextBox
public TextBox(InputDialog parent, CursorPosition initCoord, int width, int height, java.lang.String label)Custom constructorCreates a custom sized textBox inside a window
- Parameters:
parent
- the textBox containerinitCoord
- the textBox initial position relative to its containerlabel
- the textBox labelwidth
- the label widthheight
- the label height
-
-
Method Details
-
show
public void show()Draws the textBox on the screen, drawing its background, borders and label- Overrides:
show
in classWindowItem
-
onSelect
public void onSelect()Shows the textBox shadows, placing the cursor at its beginning and removing its previous input- Specified by:
onSelect
in classActiveItem
-
onRelease
public void onRelease()Hides the textBox shadows, saving an eventual input- Specified by:
onRelease
in classActiveItem
-