本文整理汇总了Java中com.googlecode.lanterna.screen.Screen.newTextGraphics方法的典型用法代码示例。如果您正苦于以下问题:Java Screen.newTextGraphics方法的具体用法?Java Screen.newTextGraphics怎么用?Java Screen.newTextGraphics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.lanterna.screen.Screen
的用法示例。
在下文中一共展示了Screen.newTextGraphics方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: display
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen) {
final TextGraphics textGraphics = screen.newTextGraphics();
textGraphics.setBackgroundColor(new RGB(0, 0, 128));
// region
new ScreenBorder(getContext(), 60, 3).display(screen, 45, 60);
textGraphics.putString(61, 46, KernelContext.getRegion(getContext()));
// gil and steps
new ScreenBorder(getContext(), 30, 6).display(screen, 38, 90);
textGraphics.putString(91, 39, "Steps");
textGraphics.putString(91, 40, Strings.padStart(String.valueOf(KernelContext.getSteps(getContext())), 28, ' '));
textGraphics.putString(91, 41, "Gil");
textGraphics.putString(91, 42, Strings.padStart(String.valueOf(KernelContext.getGil(getContext())), 28, ' '));
}
示例2: display
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen) {
new ScreenBorder(getContext(), 83, 4).display(screen, 1, 17);
final TextGraphics textGraphics = screen.newTextGraphics();
textGraphics.setBackgroundColor(KernelContext.getColor(getContext()));
textGraphics.putString(19, 3,
String.format("[LEFT] CD %s [RIGHT] | [UP] Track [DOWN] | [ACCEPT] play/stop | [MENU] auto play", cd));
getCdMenu().display(screen);
}
示例3: display
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
public void display(final Screen screen) {
final TextGraphics graphics = screen.newTextGraphics();
graphics.putString(left, top + (compact ? 1 : 2) * cursorPosition, "->");
for (int i = 0; i < menuEntries.size(); i++) {
E entry = menuEntries.get(i);
if (entry.isEnabled()) {
graphics.setForegroundColor(TextColor.ANSI.DEFAULT);
} else {
graphics.setForegroundColor(new TextColor.RGB(100, 100, 100));
}
graphics.putString(left + 4, top + i * (compact ? 1 : 2), entry.getLabel());
}
}
示例4: display
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen, final int top, final int left) {
final TextGraphics textGraphics = screen.newTextGraphics();
textGraphics.setBackgroundColor(KernelContext.getColor(context));
// place corners
textGraphics.putString(left, top, "+");
textGraphics.putString(left + width - 1, top, "+");
textGraphics.putString(left, top + height - 1, "+");
textGraphics.putString(left + width - 1, top + height - 1, "+");
// draw lines
for (int i = left + 1; i < left + width - 1; i++) {
textGraphics.putString(i, top, "-");
textGraphics.putString(i, top + height - 1, "-");
}
for (int i = top + 1; i < top + height - 1; i++) {
textGraphics.putString(left, i, "|");
textGraphics.putString(left + width - 1, i, "|");
}
// fill inner space
for (int x = left + 1; x < left + width - 1; x++) {
for (int y = top + 1; y < top + height - 1; y++) {
textGraphics.putString(x, y, " ");
}
}
}
示例5: display
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen, final int top, final int left) {
final TextGraphics textGraphics = screen.newTextGraphics();
for (int x = 0; x < size.width; x++) {
for (int y = 0; y < size.height; y++) {
// TODO handle transparent pixels and non present text
final Color background = getBackground(x, y);
final Color foreground = getForeground(x, y);
final String text = getText(x, y);
textGraphics.setBackgroundColor(convertColor(background));
textGraphics.setForegroundColor(convertColor(foreground));
textGraphics.putString(left + x, top + y, text);
}
}
}