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.Button
- All Implemented Interfaces:
Toggleable
,KeyEventListener
- Direct Known Subclasses:
ClosingButton
public abstract class Button extends ActiveItem
A clickable button
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
activeItems, id, parent, passiveItems
-
Constructor Summary
Constructors Modifier Constructor Description protected
Button(Dialog parent, CursorPosition initCoord, int width, int height, java.lang.String text)
Custom constructorprotected
Button(Dialog parent, CursorPosition initCoord, java.lang.String text)
Default constructor -
Method Summary
Methods 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
-
Button
Default constructorCreates a new Button object, using its default properties
- Parameters:
parent
- the button containerinitCoord
- the initial coordinates, relative to the containertext
- the button text
-
Button
protected Button(Dialog parent, CursorPosition initCoord, int width, int height, java.lang.String text)Custom constructorCreates a new Button object, using custom settings
- Parameters:
parent
- the button containerinitCoord
- the initial coordinates, relative to the containerwidth
- the button widthheight
- the button heighttext
- the button text
-
-
Method Details
-
drawText
protected void drawText()Draws the button text -
show
public void show()Shows the button on the screen- Overrides:
show
in classWindowItem
-
onSelect
public void onSelect()Highlights the button, drawing its shadows- Specified by:
onSelect
in classActiveItem
-
onRelease
public void onRelease()Releases the button, removing the shadow highlighting the selection- Specified by:
onRelease
in classActiveItem
-