Beispiel #1
0
 public static void main(String[] argv) {
   //		Terminal terminal = TerminalFacade.createTerminal();
   //		terminal.enterPrivateMode();
   //
   //		terminal.exitPrivateMode();
   Screen screen = TerminalFacade.createScreen();
   screen.startScreen();
   screen.putString(
       10, 5, "Press \u2191 q to exit...", Terminal.Color.WHITE, Terminal.Color.BLACK);
   screen.refresh();
   boolean done = false;
   try {
     while (!done) {
       Key key = screen.readInput();
       if (key != null) {
         if (key.getCharacter() == 'q') {
           screen.putString(
               10, 6, "That is q!!!           ", Terminal.Color.GREEN, Terminal.Color.BLACK);
           screen.refresh();
           done = true;
           Thread.sleep(2000);
         } else {
           screen.putString(
               10,
               6,
               "That is " + key.getCharacter() + ", not q",
               Terminal.Color.RED,
               Terminal.Color.BLACK);
           screen.refresh();
         }
       } else {
         Thread.sleep(20);
       }
     }
   } catch (InterruptedException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   screen.stopScreen();
 }
  public static void main(String[] args) throws InterruptedException {
    Terminal terminal = TerminalFacade.createSwingTerminal();
    terminal.enterPrivateMode();
    terminal.clearScreen();
    terminal.moveCursor(10, 5);
    terminal.putCharacter('H');
    terminal.putCharacter('e');
    terminal.putCharacter('l');
    terminal.putCharacter('l');
    terminal.putCharacter('o');
    terminal.putCharacter('!');
    terminal.putCharacter(' ');
    terminal.putCharacter(ACS.HEART);
    terminal.putCharacter(ACS.SPADES);
    terminal.putCharacter(ACS.CLUB);
    terminal.putCharacter(ACS.DIAMOND);
    terminal.putCharacter(ACS.DOUBLE_LINE_CROSS);
    terminal.putCharacter(ACS.SINGLE_LINE_CROSS);
    terminal.putCharacter(ACS.DOUBLE_LINE_T_DOWN);
    terminal.putCharacter(ACS.SINGLE_LINE_VERTICAL);
    terminal.putCharacter(ACS.SINGLE_LINE_HORIZONTAL);
    terminal.moveCursor(10, 7);
    terminal.applySGR(Terminal.SGR.ENTER_BOLD);
    terminal.putCharacter('H');
    terminal.putCharacter('e');
    terminal.putCharacter('l');
    terminal.putCharacter('l');
    terminal.putCharacter('o');
    terminal.putCharacter('!');
    terminal.putCharacter(' ');
    terminal.putCharacter(ACS.HEART);
    terminal.putCharacter(ACS.SPADES);
    terminal.putCharacter(ACS.CLUB);
    terminal.putCharacter(ACS.DIAMOND);
    terminal.putCharacter(ACS.DOUBLE_LINE_CROSS);
    terminal.putCharacter(ACS.SINGLE_LINE_CROSS);
    terminal.putCharacter(ACS.DOUBLE_LINE_T_DOWN);
    terminal.putCharacter(ACS.SINGLE_LINE_VERTICAL);
    terminal.putCharacter(ACS.SINGLE_LINE_HORIZONTAL);
    terminal.moveCursor(10, 9);
    terminal.applySGR(Terminal.SGR.ENTER_UNDERLINE);
    terminal.putCharacter('H');
    terminal.putCharacter('e');
    terminal.applySGR(Terminal.SGR.EXIT_BOLD);
    terminal.putCharacter('l');
    terminal.applySGR(Terminal.SGR.EXIT_UNDERLINE);
    terminal.putCharacter('l');
    terminal.putCharacter('o');
    terminal.applySGR(Terminal.SGR.ENTER_UNDERLINE);
    terminal.putCharacter('!');
    terminal.putCharacter(' ');
    terminal.putCharacter(ACS.HEART);
    terminal.putCharacter(ACS.SPADES);
    terminal.putCharacter(ACS.CLUB);
    terminal.putCharacter(ACS.DIAMOND);
    terminal.putCharacter(ACS.DOUBLE_LINE_CROSS);
    terminal.putCharacter(ACS.SINGLE_LINE_CROSS);
    terminal.putCharacter(ACS.DOUBLE_LINE_T_DOWN);
    terminal.putCharacter(ACS.SINGLE_LINE_VERTICAL);
    terminal.putCharacter(ACS.SINGLE_LINE_HORIZONTAL);
    terminal.applySGR(Terminal.SGR.RESET_ALL);
    terminal.moveCursor(0, 0);

    Thread.sleep(5000);
    terminal.exitPrivateMode();
  }