本文整理汇总了Java中com.googlecode.lanterna.TerminalFacade类的典型用法代码示例。如果您正苦于以下问题:Java TerminalFacade类的具体用法?Java TerminalFacade怎么用?Java TerminalFacade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TerminalFacade类属于com.googlecode.lanterna包,在下文中一共展示了TerminalFacade类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
public void initialize() {
// Initialize terminal
//this.terminal = new SwingTerminal();
//this.screen = new Screen(this.terminal);
this.screen = TerminalFacade.createScreen();
this.terminal = (SwingTerminal)this.screen.getTerminal();
this.screen.startScreen();
this.terminal.getJFrame().setLocation(0, 0);
this.terminal.getJFrame().addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
screen.stopScreen();
System.exit(0);
}
});
this.terminal.setCursorVisible(false);
printHeader();
}
示例2: getTerminal
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
private static Terminal getTerminal() {
Terminal terminal = TerminalFacade.createTerminal(System.in,
System.out, Charset.forName("UTF8"));
terminal.enterPrivateMode();
terminal.clearScreen();
terminal.setCursorVisible(false);
return terminal;
}
示例3: run
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
@Override
public void run() {
LOG.debug("Running LanternaRunner");
guiScreen = TerminalFacade.createGUIScreen(terminal);
guiScreen.getScreen().startScreen();
Window mainWindow = createMainWindow();
guiScreen.showWindow(mainWindow);
guiScreen.getScreen().stopScreen();
terminal.clearScreen();
terminal.flush();
session.close(false);
LOG.debug("Finished LanternaRunner");
}
示例4: init
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
@Override
public void init(final Workflow workflow) {
checkNotNull(workflow, "workflow is null");
this.workflow = workflow;
// Search step to follow
searchSteps();
// Test if is interactive mode
if (!isInteractiveMode()) {
return;
}
// Set terminal object
this.terminal = TerminalFacade.createUnixTerminal();
// Get terminal size
this.terminal.enterPrivateMode();
this.terminalSize = this.terminal.getTerminalSize();
this.terminal.exitPrivateMode();
// Add resize listener
this.terminal.addResizeListener(this);
// Show Welcome message
System.out.println(Globals.WELCOME_MSG);
}
示例5: main
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
public static void main(String... args) throws URISyntaxException, IOException, InterruptedException
{
CliConfig cliConfig = new Parser().parse(args);
if (cliConfig == null)
{
return;
}
// Create components
final HdfsScanner hdfsScanner = new HdfsScanner(cliConfig.getDir(), "hdfs");
final GUIScreen guiScreen = TerminalFacade.createGUIScreen();
final MainWindow mainWindow = new MainWindow(guiScreen);
final HelpPopup helpPopup = new HelpPopup(guiScreen);
final ScanningPopup scanningPopup = new ScanningPopup(guiScreen);
final Controller controller = new Controller();
// wire them
mainWindow.setController(controller);
scanningPopup.setController(controller);
controller.setGuiScreen(guiScreen);
controller.setMainWindow(mainWindow);
controller.setHelpPopup(helpPopup);
controller.setScanningPopup(scanningPopup);
controller.setHdfsScanner(hdfsScanner);
controller.startScan(cliConfig.getDir(), cliConfig.getFilter());
}
示例6: GuiConsoleType
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
/**
* Instantiates a new Gui console.
*/
private GuiConsoleType() {
// Connect to MBean Server
JMXInitializer initializer = DefaultJMXInitializer.getInstance();
initializer.connect();
String os = System.getProperty("os.name").toLowerCase();
// linux or unix
UNIX = (os.contains("nix") || os.contains("nux"));
// windows
WINDOWS = os.contains("win");
if (UNIX) {
TERMINAL = TerminalFacade.createUnixTerminal(Charset.forName("UTF8"));
} else {
TERMINAL = TerminalFacade.createTerminal(Charset.forName("UTF8"));
}
// TERMINAL.enterPrivateMode();
SCREEN = TerminalFacade.createScreen(TERMINAL);
GUI_SCREEN = TerminalFacade.createGUIScreen(SCREEN);
if (getGUI_SCREEN() == null) {
System.err.println(GenericMBeanCliBootstrap.showWelcomeScreen());
DefaultConsoleIO.getInstance().run();
return;
}
GUI_SCREEN.setTheme(GenericMBeanCliGuiTheme.getInstance());
SCREEN.startScreen();
GUI_SCREEN.showWindow(PrimaryGuiWindow.getInstance(), GUIScreen.Position.FULL_SCREEN);
}
示例7: doStartup
import com.googlecode.lanterna.TerminalFacade; //导入依赖的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();
}
示例8: GUIScreenProvider
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
public GUIScreenProvider() {
this.screen = TerminalFacade.createGUIScreen();
}
示例9: begin_
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
public void begin_() {
this.terminal = TerminalFacade.createSwingTerminal(100, 30);
if(this.terminal == null) {
System.err.println("Couldn't allocate a terminal!");
this.appRunning = false;
return;
}
this.screen = TerminalFacade.createScreen(this.terminal);
this.screenSize = terminal.getTerminalSize();
this.screenWriter = new ScreenWriter(this.screen);
this.appRunning = true;
this.screen.startScreen();
JFrame jframe = this.terminal.getJFrame();
jframe.setTitle("Solid Kingdom");
ImageIcon img = new ImageIcon("icon.png");
jframe.setIconImage(img.getImage());
jframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
jframe.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
Base.this.exitForce();
System.exit(0);
}
});
this.eventManager = new EventManager();
this.entityFactionManager = new EntityFactionManager();
this.entityClassManager = new EntityClassManager();
this.entityRaceManager = new EntityRaceManager();
this.inputHandlerManager = new InputHandlerManager();
this.menuInputHandler = new BasicMenuInputHandler();
this.dialogInputHandler = new BasicDialogInputHandler();
this.tileSelectionInputHandler = new TileSelectionInputHandler(this);
this.jsonHandler = new JsonHandler();
this.screenManager = new ScreenManager();
this.begin();
this.screen.refresh();
EventManager.addListener("refresh-screen", new EventListener() {
@Override
public void onEvent(HashMap<String, Object> args) {
Base.this.screen.refresh();
}
});
main();
}
示例10: main
import com.googlecode.lanterna.TerminalFacade; //导入依赖的package包/类
public static void main(String[] args) {
logger.info("Condi " + VERSION + " startup");
GUIScreen screen = TerminalFacade.createGUIScreen();
if (screen == null) {
System.err.println("Couldn't allocate a terminal!");
return;
}
screen.getScreen().startScreen();
new CondiWindow(screen);
}