当前位置: 首页>>代码示例>>Java>>正文


Java Terminal.getTerminalSize方法代码示例

本文整理汇总了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;
}
 
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:9,代码来源:HugeMapApp.java

示例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;
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:21,代码来源:TerminalScreen.java


注:本文中的com.googlecode.lanterna.terminal.Terminal.getTerminalSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。