示例#1
0
  /**
   * Creates a new Screen on top of a supplied terminal and will set the size of the screen to a
   * supplied value. The screen is initially blank.
   *
   * @param terminal
   * @param terminalWidth Width (number of columns) of the terminal
   * @param terminalHeight Height (number of rows) of the terminal
   */
  public Screen(Terminal terminal, int terminalWidth, int terminalHeight) {
    this.mutex = new Object();
    this.terminal = terminal;
    this.terminalSize = new TerminalSize(terminalWidth, terminalHeight);
    this.visibleScreen = new ScreenCharacter[terminalHeight][terminalWidth];
    this.backbuffer = new ScreenCharacter[terminalHeight][terminalWidth];
    this.resizeQueue = new LinkedList<TerminalSize>();
    this.wholeScreenInvalid = false;
    this.hasBeenActivated = false;
    this.cursorPosition = new TerminalPosition(0, 0);
    this.tabBehaviour = TabBehaviour.ALIGN_TO_COLUMN_8;

    this.terminal.addResizeListener(new TerminalResizeListener());

    // Initialize the screen
    clear();
  }