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


Java Terminal类代码示例

本文整理汇总了Java中com.googlecode.lanterna.terminal.Terminal的典型用法代码示例。如果您正苦于以下问题:Java Terminal类的具体用法?Java Terminal怎么用?Java Terminal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Terminal类属于com.googlecode.lanterna.terminal包,在下文中一共展示了Terminal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: useScrollHint

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
private void useScrollHint() throws IOException {
    if (scrollHint == null) { return; }

    try {
        if (scrollHint == ScrollHint.INVALID) { return; }
        Terminal term = getTerminal();
        if (term instanceof Scrollable) {
            // just try and see if it cares:
            scrollHint.applyTo( (Scrollable)term );
            // if that didn't throw, then update front buffer:
            scrollHint.applyTo( getFrontBuffer() );
        }
    }
    catch (UnsupportedOperationException uoe) { /* ignore */ }
    finally { scrollHint = null; }
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:17,代码来源:TerminalScreen.java

示例2: createTerminal

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
private Terminal createTerminal() throws IOException {
    final OutputStream outputStream = System.out;
    final InputStream inputStream = System.in;
    final Charset charset = Charset.forName(
            System.getProperty("file.encoding"));

    if (GraphicsEnvironment.isHeadless()) {
        if (isOperatingSystemWindows()) {
            return new WinTerminal(inputStream, outputStream, charset);
        }

        return new UnixTerminal(inputStream, outputStream, charset);
    }

    SwingTerminalFrame swingTerminalFrame = new SwingTerminalFrame(
            "charva-lanterna Demo",
            TerminalEmulatorDeviceConfiguration.getDefault(),
            SwingTerminalFontConfiguration.getDefault(),
            TerminalEmulatorColorConfiguration.getDefault(),
            TerminalEmulatorAutoCloseTrigger.CloseOnExitPrivateMode);

    swingTerminalFrame.setDefaultCloseOperation(
            WindowConstants.EXIT_ON_CLOSE);
    swingTerminalFrame.setVisible(true);
    return swingTerminalFrame;
}
 
开发者ID:viktor-podzigun,项目名称:charva-lanterna,代码行数:27,代码来源:CharvaDemoApp.java

示例3: main

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
public static void main(String[] args) {

		Terminal terminal = getTerminal();
		Size size = getSize(terminal);
		Size sizex5 = new Size(size.getWidth()*5, size.getHeight()*5);

		List<Level> levels = LevelRegistry.getLevels();

		Configuration.init(sizex5, levels);
		
		GameFacadeFactory gameFacadeFactory = new ClippedGameFacadeFactory(size);
		PresenterFactory presenterFactory = new PresenterFactory(gameFacadeFactory);
		TerminalViewFactory viewFactory = new TerminalViewFactory(terminal);
		ViewController controller = new ViewController(viewFactory, presenterFactory);
		controller.run();
		terminal.exitPrivateMode();
	}
 
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:18,代码来源:HugeMapApp.java

示例4: start

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
@Override
public void start(Environment environment) throws IOException {

	//TODO Make with prototype bean
	Terminal terminal = new LanternaSshTerminal(inputStream, outputStream, Charset.forName(System
			.getProperty("file.encoding")), environment);
	LanternaRunner runner = new LanternaRunner();
	runner.setTerminal(terminal);
	runner.setSession(session);
	runner.setRootMenuList(getRootMenus());
	runner.setWindowManagerService(windowManagerService);
	runner.setDictionaryService(dictionaryService);
	runner.setUidaoService(uidaoService);
	runner.setWindowActionService(windowActionService);
	taskExecutor.execute(runner);

}
 
开发者ID:frincon,项目名称:openeos,代码行数:18,代码来源:LanternaSshFactory.java

示例5: putStringColor

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
/**
 * Put a string on the terminal with a defined color.
 * @param x x position of the string
 * @param y y position of the string
 * @param s the string to print
 * @param color the foreground color of the string
 * @return x position after printing the line
 */
private int putStringColor(final int x, final int y, final String s,
    final Terminal.Color color) {

  if (color != null) {
    this.terminal.applyForegroundColor(color);
  }

  final int result = putString(x, y, s);

  if (color != null) {
    this.terminal.applyForegroundColor(Color.DEFAULT);
  }

  return result;
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:24,代码来源:LanternaUI.java

示例6: doAuthentication

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
/**
 * Do authentication.
 *
 * @param info            the info
 * @param usernameTextBox the username text box
 * @param passwordTextBox the password text box
 */
public void doAuthentication(Label info, TextBox usernameTextBox, TextBox passwordTextBox) {

    AUTHENTICATION.login(usernameTextBox.getText(), passwordTextBox.getText());

    // If Authentication is successful then show the CLI Interface
    if (AUTHENTICATION.isLoggedIn()) {
        getInstance().removeAllComponents();
        getInstance().addComponent(CliGui.getInstance().drawGui());
    }
    // Otherwise show an error message
    else {
        final String message = "Wrong Username/Password combination!! Please try again";
        GUI_HELPER.displayMessage(info, message, Terminal.Color.RED, Theme.Category.SHADOW);
    }
}
 
开发者ID:sohailalam2,项目名称:GenericMBeanCLI,代码行数:23,代码来源:PrimaryGuiWindow.java

示例7: main

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
    Terminal t = new TestTerminalFactory(args).createTerminal();
    t.enterPrivateMode();
    TerminalScreen s = new TerminalScreen(t);
    s.startScreen();
    try {
        Thread.sleep(1000);
    }
    catch(InterruptedException e) {}
    s.stopScreen();
    t.exitPrivateMode();
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:13,代码来源:Issue78.java

示例8: createTerminal

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
public Terminal createTerminal() throws IOException {
    Terminal terminal = factory.createTerminal();
    if(terminal instanceof SwingTerminalFrame) {
        ((SwingTerminalFrame)terminal).setVisible(true);
        ((SwingTerminalFrame)terminal).setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    return terminal;
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:9,代码来源:TestTerminalFactory.java

示例9: getTerminal

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的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;
}
 
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:9,代码来源:HugeMapApp.java

示例10: 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

示例11: TerminalMazeView

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
public TerminalMazeView(MazePresenter presenter, Terminal terminal) {
	_terminal = terminal;
	_presenter = presenter;
	CellUpdateListener updater = new TerminalMazeViewUpdater(terminal);
	_presenter.setCellUpdateListener(updater);
	LivesUpdateListener livesUpdater = new TerminalLivesViewUpdater(terminal);
	_presenter.setLivesUpdateListener(livesUpdater);
}
 
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:9,代码来源:TerminalMazeView.java

示例12: TerminalLevelView

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
public TerminalLevelView(LevelPresenter presenter, Terminal terminal) {
	_presenter = presenter;
	_terminal = terminal;
	LevelSelectionListener listener = new LevelViewUpdater(this);
	_presenter.setLevelSelectionListener(listener);
	_oldIndex = -1;
	_selectedIndex = -1;
}
 
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:9,代码来源:TerminalLevelView.java

示例13: main

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的package包/类
public static void main(String[] args) {

		Terminal terminal = getTerminal();
		Size size = getSize(terminal);

		List<Level> levels = LevelRegistry.getLevels();

		Configuration.init(size, levels);
		TerminalViewFactory viewFactory = new TerminalViewFactory(terminal);
		ViewController controller = new ViewController(viewFactory);
		controller.run();
		terminal.exitPrivateMode();
	}
 
开发者ID:freeuni-sdp,项目名称:snake-15,代码行数:14,代码来源:App.java

示例14: setUp

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的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

示例15: setUp

import com.googlecode.lanterna.terminal.Terminal; //导入依赖的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


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