Java Code Examples for com.googlecode.lanterna.screen.TerminalScreen#startScreen()

The following examples show how to use com.googlecode.lanterna.screen.TerminalScreen#startScreen() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SessionStatePrinter.java    From bt with Apache License 2.0 6 votes vote down vote up
public SessionStatePrinter() {
    try {
        Terminal terminal = new DefaultTerminalFactory(System.out, System.in,
                StandardCharsets.UTF_8).createTerminal();
        terminal.setCursorVisible(false);

        screen = new TerminalScreen(terminal);
        graphics = screen.newTextGraphics();
        screen.startScreen();
        clearScreen();

        started = System.currentTimeMillis();

        this.torrent = Optional.empty();
        printTorrentInfo();
    } catch (IOException e) {
        throw new RuntimeException("Failed to create terminal", e);
    }
}
 
Example 2
Source File: Issue392.java    From lanterna with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    DefaultTerminalFactory terminalFactory = new DefaultTerminalFactory();
    Terminal terminal = terminalFactory.createTerminal();
    TerminalScreen screen = new TerminalScreen(terminal);
    screen.startScreen();
    textGUI = new MultiWindowTextGUI(screen);
    setExceptionHandler();
    BasicWindow window = new BasicWindow();

    Button button = new Button("test");
    button.addListener(b -> {
        setExceptionHandler();
        throw new RuntimeException("This should be caught in the uncaght exception handler!");
    });
    window.setComponent(button);

    textGUI.addWindowAndWait(window);
    screen.stopScreen();
}
 
Example 3
Source File: TableUnitTests.java    From lanterna with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
    TerminalSize size = new TerminalSize(30, 24);
    terminal = new DefaultVirtualTerminal(size);
    TerminalScreen screen = new TerminalScreen(terminal);
    screen.startScreen();
    DefaultWindowManager windowManager = new DefaultWindowManager(new EmptyWindowDecorationRenderer(), size);
    gui = new MultiWindowTextGUI(new SeparateTextGUIThread.Factory(), screen, windowManager, null, new EmptySpace());
    window = new BasicWindow();
    window.setHints(Arrays.asList(Hint.NO_DECORATIONS, Hint.FIT_TERMINAL_WINDOW, Hint.FULL_SCREEN));
    table = new Table<>("a", "b");
    window.setComponent(new Panel(new LinearLayout().setSpacing(0)).addComponent(table, LinearLayout.createLayoutData(LinearLayout.Alignment.Fill)));
    gui.addWindow(window);
    model = table.getTableModel();
}
 
Example 4
Source File: Issue78.java    From lanterna with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    Terminal t = new TestTerminalFactory(args).createTerminal();
    t.enterPrivateMode();
    TerminalScreen s = new TerminalScreen(t);
    s.startScreen();
    try {
        Thread.sleep(1000);
    }
    catch(InterruptedException e) {}
    s.stopScreen();
    t.exitPrivateMode();
}
 
Example 5
Source File: Issue446.java    From lanterna with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    DefaultTerminalFactory terminalFactory = new DefaultTerminalFactory();
    Terminal terminal = terminalFactory.createTerminal();
    TerminalScreen screen = new TerminalScreen(terminal);
    screen.startScreen();
    WindowBasedTextGUI textGUI = new MultiWindowTextGUI(screen);
    textGUI.addWindowAndWait(buildWindow());
}