use of org.apache.hadoop.hbase.hbtop.terminal.Terminal in project hbase by apache.
the class TestKeyPress method main.
public static void main(String[] args) throws Exception {
try (Terminal terminal = new TerminalImpl()) {
terminal.hideCursor();
terminal.refresh();
while (true) {
KeyPress keyPress = terminal.pollKeyPress();
if (keyPress == null) {
TimeUnit.MILLISECONDS.sleep(100);
continue;
}
terminal.getTerminalPrinter(0).print(keyPress.toString()).endOfLine();
terminal.refresh();
if (keyPress.getType() == KeyPress.Type.F12) {
break;
}
}
}
}
use of org.apache.hadoop.hbase.hbtop.terminal.Terminal in project hbase by apache.
the class TestCursor method main.
public static void main(String[] args) throws Exception {
try (Terminal terminal = new TerminalImpl()) {
terminal.refresh();
terminal.setCursorPosition(0, 0);
terminal.getTerminalPrinter(0).print("aaa").endOfLine();
terminal.refresh();
TimeUnit.SECONDS.sleep(1);
terminal.getTerminalPrinter(0).print("bbb").endOfLine();
terminal.refresh();
TimeUnit.SECONDS.sleep(1);
terminal.setCursorPosition(1, 0);
terminal.refresh();
TimeUnit.SECONDS.sleep(1);
terminal.setCursorPosition(2, 0);
terminal.refresh();
TimeUnit.SECONDS.sleep(1);
terminal.setCursorPosition(3, 0);
terminal.refresh();
TimeUnit.SECONDS.sleep(1);
terminal.setCursorPosition(0, 1);
terminal.refresh();
TimeUnit.SECONDS.sleep(1);
terminal.getTerminalPrinter(1).print("ccc").endOfLine();
terminal.refresh();
TimeUnit.SECONDS.sleep(1);
terminal.getTerminalPrinter(3).print("Press any key to finish").endOfLine();
terminal.refresh();
while (true) {
KeyPress keyPress = terminal.pollKeyPress();
if (keyPress == null) {
TimeUnit.MILLISECONDS.sleep(100);
continue;
}
break;
}
}
}
use of org.apache.hadoop.hbase.hbtop.terminal.Terminal in project hbase by apache.
the class TestTerminalPrinter method main.
public static void main(String[] args) throws Exception {
try (Terminal terminal = new TerminalImpl()) {
terminal.hideCursor();
terminal.refresh();
TerminalPrinter printer = terminal.getTerminalPrinter(0);
printer.print("Normal string").endOfLine();
printer.startHighlight().print("Highlighted string").stopHighlight().endOfLine();
printer.startBold().print("Bold string").stopBold().endOfLine();
printer.startHighlight().startBold().print("Highlighted bold string").stopBold().stopHighlight().endOfLine();
printer.endOfLine();
printer.print("Press any key to finish").endOfLine();
terminal.refresh();
while (true) {
KeyPress keyPress = terminal.pollKeyPress();
if (keyPress == null) {
TimeUnit.MILLISECONDS.sleep(100);
continue;
}
break;
}
}
}
Aggregations