Class Cursor


  • public class Cursor
    extends java.lang.Object

    Help class in handling the cursor in an ANSI console, if the output corresponds to an ANSI compatible console (Linux), to move the course it can be done in this way:

    System.out.prinln(Cursor.up(2));
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Sequence backward​(int count)
      Move the cursor {count} lines to left
      static Sequence down​(int count)
      Move cursor down {count} lines
      static Sequence forward​(int count)
      Move the cursor {count} lines to right
      static Sequence home​(int row, int column)
      Move the cursor home to the coordinates {row}, {column}
      static Sequence up​(int count)
      Move cursor up {count} lines
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • home

        public static Sequence home​(int row,
                                    int column)
        Move the cursor home to the coordinates {row}, {column}
        Parameters:
        row -
        column -
        Returns:
        Action sequence to be interpreted by the console
      • up

        public static Sequence up​(int count)
        Move cursor up {count} lines
        Parameters:
        count - Number of lines to move up
        Returns:
        Action sequence to be interpreted by the console
      • down

        public static Sequence down​(int count)
        Move cursor down {count} lines
        Parameters:
        count - Number of lines to move down
        Returns:
        Action sequence to be interpreted by the console
      • forward

        public static Sequence forward​(int count)
        Move the cursor {count} lines to right
        Parameters:
        count - Number of spaces to move to right
        Returns:
        Action sequence to be interpreted by the console
      • backward

        public static Sequence backward​(int count)
        Move the cursor {count} lines to left
        Parameters:
        count - Number of spaces to move to left
        Returns:
        Action sequence to be interpreted by the console