本文整理汇总了Java中com.googlecode.lanterna.terminal.TerminalSize类的典型用法代码示例。如果您正苦于以下问题:Java TerminalSize类的具体用法?Java TerminalSize怎么用?Java TerminalSize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TerminalSize类属于com.googlecode.lanterna.terminal包,在下文中一共展示了TerminalSize类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: calculatePreferredSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
protected TerminalSize calculatePreferredSize() {
int columns = 0;
int rows = 0;
int total = CHARACTERS_ARROWS + maximum - minimum + 1;
switch (orientation) {
case HORIZONTAL:
rows = 1;
columns = total;
break;
case VERTICAL:
columns = 1;
rows = total;
break;
}
return new TerminalSize(columns, rows);
}
开发者ID:frincon,项目名称:openeos,代码行数:20,代码来源:ScrollBar.java
示例2: getSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的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
示例3: updateLives
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public void updateLives(int newLives) {
TerminalSize tSize = _terminal.getTerminalSize();
String text = String.format(" lives - %d ", newLives);
for(int i=0;i<text.length();i++){
_terminal.moveCursor(tSize.getColumns()-(text.length() -i),1);
_terminal.putCharacter(text.charAt(i));
}
}
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:12,代码来源:TerminalLivesViewUpdater.java
示例4: show
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public void show() {
_terminal.clearScreen();
String[] names = { " Game Over ",
"Do you want to play again?", " Press Y to play again.",
" Press N or ESC to quit." };
TerminalSize screenSize = _terminal.getTerminalSize();
for (int i = 0; i < names.length; i++) {
_terminal.moveCursor(screenSize.getColumns() / 2 - 15,
screenSize.getRows() / 2 - 2 + i);
writeLine(String.format("%s", names[i]));
}
_terminal.flush();
while (true) {
Key p = _terminal.readInput();
if (p == null)
continue;
char ch = p.getCharacter();
if (p.getKind() == Kind.Escape || ch == 'n')
break;
if (ch == 'y') {
_continueGame = true;
break;
}
}
}
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:29,代码来源:TerminalGameOverView.java
示例5: setUp
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
key = Mockito.mock(Key.class);
terminal = Mockito.mock(Terminal.class);
terminalSize = Mockito.mock(TerminalSize.class);
presenter = Mockito.mock(GameOverPresenter.class);
gameOver = Mockito.spy(new TerminalGameOverView(presenter, terminal));
Mockito.when(terminalSize.getRows()).thenReturn(100);
Mockito.when(terminalSize.getColumns()).thenReturn(100);
Mockito.when(terminal.getTerminalSize()).thenReturn(terminalSize);
}
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:13,代码来源:TerminalGameOverViewTest.java
示例6: setUp
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Before
public void setUp(){
terminal=Mockito.mock(Terminal.class);
presenter = Mockito.mock(HighScorePresenter.class);
key=Mockito.mock(Key.class);
when(terminal.getTerminalSize()).thenReturn(new TerminalSize(1000, 1000));
when(presenter.getHighScoreInfo()).thenReturn("");
when(terminal.readInput()).thenReturn(key);
}
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:11,代码来源:TerminalHighScoreViewTest.java
示例7: calculatePreferredSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
protected TerminalSize calculatePreferredSize() {
// Get size of colums
int width = SEPARATOR_WIDTH;
for (MultiColumnListBoxColumn column : columnList) {
width += column.getSize() + SEPARATOR_WIDTH;
}
int height = HEADER_HEIGHT + rowList.size();
return new TerminalSize(width, height);
}
开发者ID:frincon,项目名称:openeos,代码行数:11,代码来源:MultiColumnListBox.java
示例8: queryTerminalSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
@Deprecated
public TerminalSize queryTerminalSize() {
try {
int cols = Integer.parseInt(environment.getEnv().get(Environment.ENV_COLUMNS));
int rows = Integer.parseInt(environment.getEnv().get(Environment.ENV_LINES));
TerminalSize size = new TerminalSize(cols, rows);
return size;
} catch (Exception ex) {
LOG.error("Error getting terminal size", ex);
return super.getTerminalSize();
}
}
开发者ID:frincon,项目名称:openeos,代码行数:14,代码来源:LanternaSshTerminal.java
示例9: getTerminalSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public TerminalSize getTerminalSize() {
try {
int cols = Integer.parseInt(environment.getEnv().get(Environment.ENV_COLUMNS));
int rows = Integer.parseInt(environment.getEnv().get(Environment.ENV_LINES));
TerminalSize size = new TerminalSize(cols, rows);
return size;
} catch (Exception ex) {
LOG.error("Error getting terminal size", ex);
return super.getTerminalSize();
}
}
开发者ID:frincon,项目名称:openeos,代码行数:14,代码来源:LanternaSshTerminal.java
示例10: onResized
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public void onResized(final TerminalSize terminalSize) {
synchronized (this) {
this.terminalSize = terminalSize;
}
}
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:8,代码来源:LanternaUI.java
示例11: CliGui
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
/**
* Instantiates a new Cli mbean.
*/
private CliGui() {
TerminalSize size = new TerminalSize(100, 100);
results = new TextArea(size, GenericMBeanCliBootstrap.showWelcomeScreen().toString());
getResults().getHotspot();
cliCommandTextBox = new TextBox("", 100);
}
开发者ID:sohailalam2,项目名称:GenericMBeanCLI,代码行数:12,代码来源:CliGui.java
示例12: TranslationTextGraphics
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
public TranslationTextGraphics(TextGraphics originalGraphics, TerminalPosition translation, TerminalSize size) {
this.originalGraphics = originalGraphics;
this.translation = translation;
this.size = size;
}
开发者ID:frincon,项目名称:openeos,代码行数:6,代码来源:TranslationTextGraphics.java
示例13: fillRectangle
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public void fillRectangle(char character, TerminalPosition topLeft, TerminalSize rectangleSize) {
TerminalPosition newTopLeft = new TerminalPosition(topLeft.getColumn() + translation.getColumn(), topLeft.getRow()
+ translation.getRow());
originalGraphics.fillRectangle(character, newTopLeft, rectangleSize);
}
开发者ID:frincon,项目名称:openeos,代码行数:7,代码来源:TranslationTextGraphics.java
示例14: getSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public TerminalSize getSize() {
return size;
}
开发者ID:frincon,项目名称:openeos,代码行数:5,代码来源:TranslationTextGraphics.java
示例15: subAreaGraphics
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public TextGraphics subAreaGraphics(TerminalPosition topLeft, TerminalSize subAreaSize) {
// TODO Auto-generated method stub
return null;
}
开发者ID:frincon,项目名称:openeos,代码行数:6,代码来源:TranslationTextGraphics.java
示例16: doStartup
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
/**
* Contains the main event loop that drives the game. This method will not
* return until {@link LanternaFrontend#shutdown} is called.
*/
final void doStartup() {
Vec2i screenSize = getSize();
if (isTTY) System.out.print("\033[8;" + screenSize.y + ";" + screenSize.x + "t");
Screen screen = TerminalFacade.createScreen();
screen.startScreen();
{
TerminalSize size = screen.getTerminalSize();
//onResize(new Vec2i(size.getColumns(),size.getRows()));
onResize(screenSize);
}
long time = new Date().getTime();
while (running) {
try {
// First do anything that we need to do for updating screen size.
/* if (screen.resizePending()) {
screen.refresh();
TerminalSize size = screen.getTerminalSize();
onResize(new Vec2i(size.getColumns(),size.getRows()));
} */
// First do anything that we need to do for updating screen size.
// Then we draw the screen.
screen.clear();
onDraw(new Section(screen, new Vec2i(0,0), screenSize));
screen.refresh();
// We can now give the program any key presses
Key key = screen.readInput();
if (key != null)
onKeyPressed(key);
// Then we take care of ticks.
long currentTime = new Date().getTime();
onTick(currentTime - time);
time = currentTime;
} catch (NullPointerException e) {
// For now, ignore it.
}
}
screen.stopScreen();
}
开发者ID:melloc,项目名称:roguelike,代码行数:48,代码来源:LanternaFrontend.java
示例17: getScreenSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
public TerminalSize getScreenSize() {
return this.screenSize;
}
开发者ID:Teascade,项目名称:Solid-Kingdom,代码行数:4,代码来源:Base.java
示例18: FolderChooser
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
public FolderChooser(GUIScreen screen) {
super("Choose folder to scan");
FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
};
FileTreeItem root = new FileTreeItem(new File("/"), null, fileFilter);
Tree tree = new Tree(root);
tree.setOnItemSelectedListener(new Tree.OnItemSelectedListener() {
@Override
public void itemSelected(TreeItem item) {
File file = ((FileTreeItem) item).getFile();
logger.debug("Folder selected: " + file.getAbsolutePath());
selected = file;
}
});
addComponent(tree, BorderLayout.CENTER);
addComponent(new EmptySpace());
Panel buttonsPanel = new Panel(Panel.Orientation.HORISONTAL);
buttonsPanel.addComponent(new Button("Cancel", new Action() {
@Override
public void doAction() {
close();
}
}));
buttonsPanel.addComponent(new EmptySpace());
buttonsPanel.addComponent(new Button("Scan", new Action() {
@Override
public void doAction() {
close();
}
}));
addComponent(buttonsPanel, BorderLayout.BOTTOM, BorderLayout.CENTER);
TerminalSize size = screen.getScreen().getTerminalSize();
setWindowSizeOverride(new TerminalSize(size.getColumns() - 8, size.getRows() - 5));
screen.showWindow(this, GUIScreen.Position.OVERLAPPING);
}
开发者ID:swapii,项目名称:condi,代码行数:58,代码来源:FolderChooser.java
示例19: calculatePreferredSize
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
protected TerminalSize calculatePreferredSize() {
return new TerminalSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
开发者ID:swapii,项目名称:condi,代码行数:5,代码来源:Tree.java
示例20: repaint
import com.googlecode.lanterna.terminal.TerminalSize; //导入依赖的package包/类
@Override
public void repaint(TextGraphics graphics) {
// Clear area
graphics.setBackgroundColor(Terminal.Color.DEFAULT);
graphics.setForegroundColor(Terminal.Color.WHITE);
graphics.fillArea(' ');
height = graphics.getHeight();
itemsCount = buildChilds(graphics, 0, root, -1);
if (itemsCount > 0) {
// Draw scroll bar
double proportion = (double) height / itemsCount;
int startRow = (int) (firstVisibleRow * proportion);
int fillRows = (int) (height * proportion) + 1;
graphics.setBackgroundColor(Terminal.Color.DEFAULT);
graphics.setForegroundColor(Terminal.Color.WHITE);
graphics.fillRectangle('░', new TerminalPosition(graphics.getWidth() - 1, 0), new TerminalSize(1, height));
graphics.fillRectangle('█', new TerminalPosition(graphics.getWidth() - 1, startRow), new TerminalSize(1, fillRows));
}
}
开发者ID:swapii,项目名称:condi,代码行数:30,代码来源:Tree.java
注:本文中的com.googlecode.lanterna.terminal.TerminalSize类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论