java.lang.Object
it.polimi.ingsw.view.cli.console.CursorPosition
- All Implemented Interfaces:
KeyEventListener
public class CursorPosition extends java.lang.Object implements KeyEventListener
-
Field Summary
Fields Modifier and Type Field Description static CursorPositionmaxCursor -
Constructor Summary
Constructors Constructor Description CursorPosition()CursorPosition(int row, int col) -
Method Summary
Modifier and Type Method Description voidblink()intgetCol()intgetRow()voidmoveCursorTo()voidmoveToHome()static CursorPositionoffset(CursorPosition pos, int rowOff, int colOff)voidonBackspace()Defines the listener behavior when theBackspacekey is pressedvoidonCarriageReturn()Defines the listener behavior when theEnterkey is pressedvoidonPrintableKey(char key)Defines the listener behavior when a printable character key is pressedvoidsetAsHome()voidsetCoordinates(int row, int col)voidstopBlink()Methods 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, onTab
-
Field Details
-
Constructor Details
-
CursorPosition
public CursorPosition() -
CursorPosition
public CursorPosition(int row, int col)
-
-
Method Details
-
offset
-
setCoordinates
public void setCoordinates(int row, int col) -
getRow
public int getRow() -
getCol
public int getCol() -
setAsHome
public void setAsHome() -
moveToHome
public void moveToHome() -
moveCursorTo
public void moveCursorTo() -
blink
public void blink() -
stopBlink
public void stopBlink() -
onPrintableKey
public void onPrintableKey(char key)Description copied from interface:KeyEventListenerDefines the listener behavior when a printable character key is pressed- Specified by:
onPrintableKeyin interfaceKeyEventListener
-
onCarriageReturn
public void onCarriageReturn()Description copied from interface:KeyEventListenerDefines the listener behavior when theEnterkey is pressed- Specified by:
onCarriageReturnin interfaceKeyEventListener
-
onBackspace
public void onBackspace()Description copied from interface:KeyEventListenerDefines the listener behavior when theBackspacekey is pressed- Specified by:
onBackspacein interfaceKeyEventListener
-