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();
 }
Beispiel #2
0
 @Override
 public boolean onInput(final Key k, final GUIScreen gui) {
   switch (k.getKind()) {
     case NormalKey:
       switch (k.getCharacter()) {
         case 'q':
           return this.navigation.backOneLevel();
         default:
       }
     default:
       return false;
   }
 }