Module AM37

Class Console

All Implemented Interfaces:
KeyEventListener

public final class Console
extends Window
implements KeyEventListener
Console utilities
  • Field Details

  • Method Details

    • init

      public static Console init​(CLI cli)
      Initializes the Console
      Parameters:
      cli - the view invoking the console
    • isOpen

      public static boolean isOpen​(Window window)
      Determines if a Window is still showing on the console
      Parameters:
      window - the window to check
      Returns:
      true if the window is still showing, false otherwise
    • currentWindow

      public static Window currentWindow()
      Provides the last window opened
      Returns:
      the last window opened, null if none has been shown
    • numberOfWindowsOpen

      public static int numberOfWindowsOpen()
      Provides the number of windows open
      Returns:
      the number of open windows
    • addWindow

      public static void addWindow​(Window window)
      Adds, if absent, a new Window to the console windows list
      Parameters:
      window - the window to add
    • closeWindow

      public static void closeWindow​(Window window)
      Closes the given window, re-enabling the underlying one
      Parameters:
      window - the window to close
    • close

      public static void close()
      Closes the program, bringing the terminal back to canonical mode
    • placeCursor

      public static void placeCursor​(int row, int col)
      Places the cursor at the given coordinates
      Parameters:
      row - the target row
      col - the target col
    • showCursor

      public static void showCursor()
      Makes the cursor blink