本文整理汇总了Java中com.googlecode.lanterna.terminal.Terminal.getTerminalSize方法的典型用法代码示例。如果您正苦于以下问题:Java Terminal.getTerminalSize方法的具体用法?Java Terminal.getTerminalSize怎么用?Java Terminal.getTerminalSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.lanterna.terminal.Terminal
的用法示例。
在下文中一共展示了Terminal.getTerminalSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSize
import com.googlecode.lanterna.terminal.Terminal; //导入方法依赖的package包/类
private static Size getSize(Terminal terminal) {
TerminalSize terminalSize = terminal.getTerminalSize();
int width = terminalSize.getColumns();
int height = terminalSize.getRows();
Size size = new Size(width, height);
return size;
}
示例2: TerminalScreen
import com.googlecode.lanterna.terminal.Terminal; //导入方法依赖的package包/类
/**
* Creates a new Screen on top of a supplied terminal, will query the terminal for its size. The screen is initially
* blank. The default character used for unused space (the newly initialized state of the screen and new areas after
* expanding the terminal size) will be a blank space in 'default' ANSI front- and background color.
* <p/>
* Before you can display the content of this buffered screen to the real underlying terminal, you must call the
* {@code startScreen()} method. This will ask the terminal to enter private mode (which is required for Screens to
* work properly). Similarly, when you are done, you should call {@code stopScreen()} which will exit private mode.
*
* @param terminal Terminal object to create the DefaultScreen on top of.
* @param defaultCharacter What character to use for the initial state of the screen and expanded areas
* @throws java.io.IOException If there was an underlying I/O error when querying the size of the terminal
*/
public TerminalScreen(Terminal terminal, TextCharacter defaultCharacter) throws IOException {
super(terminal.getTerminalSize(), defaultCharacter);
this.terminal = terminal;
this.terminal.addResizeListener(new TerminalResizeListener());
this.isStarted = false;
this.fullRedrawHint = true;
}