Introduction
Lets start with a simple app which prints "hello world" in a view.
@Autowired
TerminalUIBuilder builder;
void sample() {
TerminalUI ui = builder.build();
BoxView view = new BoxView();
ui.configure(view);
view.setDrawFunction((screen, rect) -> {
screen.writerBuilder()
.build()
.text("Hello World", rect, HorizontalAlign.CENTER, VerticalAlign.CENTER);
return rect;
});
ui.setRoot(view, true);
ui.run();
}
There is not much to see here other than TerminalUI
is a class handling
all logic aroung views and uses View
as it’s root view.