本文整理汇总了Java中com.googlecode.lanterna.screen.Screen.stopScreen方法的典型用法代码示例。如果您正苦于以下问题:Java Screen.stopScreen方法的具体用法?Java Screen.stopScreen怎么用?Java Screen.stopScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.lanterna.screen.Screen
的用法示例。
在下文中一共展示了Screen.stopScreen方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
void run(String[] args) throws IOException, InterruptedException {
Screen screen = new TestTerminalFactory(args).createScreen();
screen.startScreen();
MultiWindowTextGUI textGUI = new MultiWindowTextGUI(new SeparateTextGUIThread.Factory(), screen);
textGUI.setBlockingIO(false);
textGUI.setEOFWhenNoWindows(true);
textGUI.isEOFWhenNoWindows(); //No meaning, just to silence IntelliJ:s "is never used" alert
try {
init(textGUI);
AsynchronousTextGUIThread guiThread = (AsynchronousTextGUIThread)textGUI.getGUIThread();
guiThread.start();
guiThread.waitForStop();
}
finally {
screen.stopScreen();
}
}
示例2: main
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException, IOException {
SwingTerminalFrame terminal = new SwingTerminalFrame(SwingTerminalFrame.AutoCloseTrigger.CloseOnExitPrivateMode);
terminal.setCursorVisible(false);
Screen screen = new TerminalScreen(terminal);
screen.startScreen();
terminal.setTitle("Freedom: An arena-battle roguelike");
terminal.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
terminal.setResizable(false);
terminal.setVisible(true);
while(screen.pollInput() == null) {
if(screen.doResizeIfNecessary() != null) {
screen.refresh();
}
Thread.sleep(100);
}
screen.stopScreen();
}
示例3: main
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException {
Screen screen = new TestTerminalFactory(args).createScreen();
screen.startScreen();
MultiWindowTextGUI textGUI = new MultiWindowTextGUI(screen);
textGUI.setEOFWhenNoWindows(true);
try {
final BasicWindow window = new BasicWindow("Button test");
Panel contentArea = new Panel();
contentArea.setLayoutManager(new LinearLayout(Direction.VERTICAL));
contentArea.addComponent(new Button(""));
contentArea.addComponent(new Button("TRE"));
contentArea.addComponent(new Button("Button"));
contentArea.addComponent(new Button("Another button"));
contentArea.addComponent(new EmptySpace(new TerminalSize(5, 1)));
//contentArea.addComponent(new Button("Here is a\nmulti-line\ntext segment that is using \\n"));
contentArea.addComponent(new Button("OK", new Runnable() {
@Override
public void run() {
window.close();
}
}));
window.setComponent(contentArea);
textGUI.addWindowAndWait(window);
}
finally {
screen.stopScreen();
}
}
示例4: main
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException {
Screen screen = new TestTerminalFactory(args).createScreen();
screen.startScreen();
WindowBasedTextGUI textGUI = new MultiWindowTextGUI(screen);
try {
BasicWindow window = new BasicWindow("Label test");
Panel contentArea = new Panel();
contentArea.setLayoutManager(new LinearLayout(Direction.VERTICAL));
contentArea.addComponent(new Label("This is a single line label"));
contentArea.addComponent(new Label("This is another label on the second line"));
contentArea.addComponent(new EmptySpace(new TerminalSize(5, 1)));
contentArea.addComponent(new Label("Here is a\nmulti-line\ntext segment that is using \\n"));
Label label = new Label("We can change foreground color...");
label.setForegroundColor(TextColor.ANSI.BLUE);
contentArea.addComponent(label);
label = new Label("...and background color...");
label.setBackgroundColor(TextColor.ANSI.MAGENTA);
contentArea.addComponent(label);
label = new Label("...and add custom SGR styles!");
label.addStyle(SGR.BOLD);
label.addStyle(SGR.UNDERLINE);
contentArea.addComponent(label);
contentArea.addComponent(new EmptySpace(new TerminalSize(5, 1)));
contentArea.addComponent(new Label("Here is an animated label:"));
contentArea.addComponent(AnimatedLabel.createClassicSpinningLine());
window.setComponent(contentArea);
textGUI.addWindow(window);
textGUI.updateScreen();
while(!textGUI.getWindows().isEmpty()) {
textGUI.processInput();
if(textGUI.isPendingUpdate()) {
textGUI.updateScreen();
}
else {
Thread.sleep(1);
}
}
}
finally {
screen.stopScreen();
}
}
示例5: doStartup
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的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();
}
示例6: main
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
public static void main(String... args) throws IOException {
Terminal term = new DefaultTerminalFactory().createTerminal();
Screen screen = new TerminalScreen(term);
WindowManager windowManager = new DefaultWindowManager();
Component background = new EmptySpace(TextColor.ANSI.DEFAULT);
final WindowBasedTextGUI gui = new MultiWindowTextGUI(screen, windowManager, background);
screen.startScreen();
gui.addWindowAndWait(new BasicWindow("Issue155") {{
setComponent(createUi(gui, this));
}});
screen.stopScreen();
}
示例7: main
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
public static void main(String... args) throws IOException {
Terminal term = new DefaultTerminalFactory().createTerminal();
Screen screen = new TerminalScreen(term);
WindowManager windowManager = new DefaultWindowManager();
Component background = new EmptySpace(TextColor.ANSI.DEFAULT);
final WindowBasedTextGUI gui = new MultiWindowTextGUI(screen, windowManager, background);
screen.startScreen();
gui.addWindowAndWait(new BasicWindow("Issue150") {{
setComponent(createUi());
}});
screen.stopScreen();
}