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 CursorPosition
maxCursor
-
Constructor Summary
Constructors Constructor Description CursorPosition()
CursorPosition(int row, int col)
-
Method Summary
Modifier and Type Method Description void
blink()
int
getCol()
int
getRow()
void
moveCursorTo()
void
moveToHome()
static CursorPosition
offset(CursorPosition pos, int rowOff, int colOff)
void
onBackspace()
Defines the listener behavior when theBackspace
key is pressedvoid
onCarriageReturn()
Defines the listener behavior when theEnter
key is pressedvoid
onPrintableKey(char key)
Defines the listener behavior when a printable character key is pressedvoid
setAsHome()
void
setCoordinates(int row, int col)
void
stopBlink()
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, 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:KeyEventListener
Defines the listener behavior when a printable character key is pressed- Specified by:
onPrintableKey
in interfaceKeyEventListener
-
onCarriageReturn
public void onCarriageReturn()Description copied from interface:KeyEventListener
Defines the listener behavior when theEnter
key is pressed- Specified by:
onCarriageReturn
in interfaceKeyEventListener
-
onBackspace
public void onBackspace()Description copied from interface:KeyEventListener
Defines the listener behavior when theBackspace
key is pressed- Specified by:
onBackspace
in interfaceKeyEventListener
-