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 voidonRelease()Hides the textBox shadows, saving an eventual inputvoidonSelect()Shows the textBox shadows, placing the cursor at its beginning and removing its previous inputvoidshow()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, onDisableMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getCli, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem, removeMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getColor, getHeight, getInitCoord, getTextColor, getWidth, hideBorders, loadPropertiesFileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
showin classWindowItem
-
onSelect
public void onSelect()Shows the textBox shadows, placing the cursor at its beginning and removing its previous input- Specified by:
onSelectin classActiveItem
-
onRelease
public void onRelease()Hides the textBox shadows, saving an eventual input- Specified by:
onReleasein classActiveItem
-