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


Java DefaultTerminalFactory类代码示例

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


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

示例1: SessionStatePrinter

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的package包/类
public SessionStatePrinter() {
    try {
        Terminal terminal = new DefaultTerminalFactory(System.out, System.in,
                 Charset.forName("UTF-8")).createTerminal();
        terminal.setCursorVisible(false);

        screen = new TerminalScreen(terminal);
        graphics = screen.newTextGraphics();
        screen.startScreen();
        screen.clear();

        started = System.currentTimeMillis();

        this.torrent = Optional.empty();
        printTorrentInfo();
    } catch (IOException e) {
        throw new RuntimeException("Failed to create terminal", e);
    }
}
 
开发者ID:atomashpolskiy,项目名称:bt,代码行数:20,代码来源:SessionStatePrinter.java

示例2: TestTerminalFactory

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的package包/类
public TestTerminalFactory(String[] args, SwingTerminalFrame.AutoCloseTrigger autoCloseTrigger) {
    factory = new DefaultTerminalFactory();
    factory.setSwingTerminalFrameAutoCloseTrigger(autoCloseTrigger);
    for(String arg: args) {
        if("--no-swing".equals(arg)) {
            factory.setSuppressSwingTerminalFrame(true);
        }
        else if("--mouse-click".equals(arg)) {
            factory.setMouseCaptureMode(MouseCaptureMode.CLICK_RELEASE);
        }
        else if("--mouse-drag".equals(arg)) {
            factory.setMouseCaptureMode(MouseCaptureMode.CLICK_RELEASE_DRAG);
        }
        else if("--mouse-move".equals(arg)) {
            factory.setMouseCaptureMode(MouseCaptureMode.CLICK_RELEASE_DRAG_MOVE);
        }
    }

}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:20,代码来源:TestTerminalFactory.java

示例3: main

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	Terminal terminal = new DefaultTerminalFactory().createTerminal();
	Screen screen = new TerminalScreen(terminal);
	screen.startScreen();
	Panel panel = new Panel(new BorderLayout());

	Table<String> table = new Table<>("- Quotation -");
	table.getTableModel().addRow("135.09");
	table.getTableModel().addRow("134.56");
	table.getTableModel().addRow("134.27");
	table.getTableModel().addRow("133.90");
	table.getTableModel().addRow("132.81");
	table.setLayoutData(BorderLayout.Location.RIGHT);

	panel.addComponent(table);

	TextBox textBox = new TextBox("EMPTY", TextBox.Style.MULTI_LINE);
	textBox.setLayoutData(BorderLayout.Location.CENTER);
	panel.addComponent(textBox);

	// Create window to hold the panel
	BasicWindow window = new BasicWindow();
	window.setComponent(panel);
	window.setHints(Arrays.asList(Window.Hint.FULL_SCREEN));

	// Create gui and start gui
	MultiWindowTextGUI gui = new MultiWindowTextGUI(screen, new DefaultWindowManager(),
			new EmptySpace(TextColor.ANSI.BLUE));
	gui.addWindowAndWait(window);
}
 
开发者ID:michaelliao,项目名称:crypto-exchange,代码行数:31,代码来源:AgentClient.java

示例4: main

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的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();
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:13,代码来源:Issue155.java

示例5: main

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的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();
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:13,代码来源:Issue150.java

示例6: BasicTerminal

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的package包/类
public BasicTerminal(PredictionGenerator predictionGenerator, CommandExecutor commandExecutor) throws IOException {
    this.predictionGenerator = predictionGenerator;
    this.commandExecutor = commandExecutor;

    TerminalFactory factory = new DefaultTerminalFactory();
    screen = new TerminalScreen(factory.createTerminal());
}
 
开发者ID:oserban,项目名称:simple-terminal,代码行数:8,代码来源:BasicTerminal.java

示例7: start

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的package包/类
public static void start() {
	ModelTest.exitIfProblems();
	Frontend.setInstance(new LanternaFrontend());
	try {
		Terminal terminal = new DefaultTerminalFactory().createTerminal();
		Screen screen = new TerminalScreen(terminal);
		screen.startScreen();
		
		new Lanterna(screen);
	} catch (Exception x) {
		throw new RuntimeException(x);
	}		
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:14,代码来源:Lanterna.java

示例8: main

import com.googlecode.lanterna.terminal.DefaultTerminalFactory; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
    //Setup a standard Screen
    Terminal terminal = new DefaultTerminalFactory().createTerminal();
    Screen screen = new TerminalScreen(terminal);
    screen.startScreen();
    screen.setCursorPosition(null);

    //Create an 'image' that we fill with recognizable characters
    TextImage image = new BasicTextImage(5, 5);
    TextCharacter imageCharacter = new TextCharacter('X');
    TextGraphics textGraphics = image.newTextGraphics();
    textGraphics.drawRectangle(
            TerminalPosition.TOP_LEFT_CORNER,
            new TerminalSize(5, 5),
            imageCharacter.withBackgroundColor(TextColor.ANSI.RED));
    textGraphics.drawRectangle(
            TerminalPosition.OFFSET_1x1,
            new TerminalSize(3, 3),
            imageCharacter.withBackgroundColor(TextColor.ANSI.MAGENTA));
    textGraphics.setCharacter(2, 2,
            imageCharacter.withBackgroundColor(TextColor.ANSI.CYAN));

    TextGraphics screenGraphics = screen.newTextGraphics();
    screenGraphics.setBackgroundColor(TextColor.Indexed.fromRGB(50, 50, 50));
    screenGraphics.fill(' ');
    screenGraphics.drawImage(TerminalPosition.OFFSET_1x1, image);
    screenGraphics.drawImage(new TerminalPosition(8, 1), image, TerminalPosition.TOP_LEFT_CORNER, image.getSize().withRelativeColumns(-4));
    screenGraphics.drawImage(new TerminalPosition(10, 1), image, TerminalPosition.TOP_LEFT_CORNER, image.getSize().withRelativeColumns(-3));
    screenGraphics.drawImage(new TerminalPosition(13, 1), image, TerminalPosition.TOP_LEFT_CORNER, image.getSize().withRelativeColumns(-2));
    screenGraphics.drawImage(new TerminalPosition(17, 1), image, TerminalPosition.TOP_LEFT_CORNER, image.getSize().withRelativeColumns(-1));
    screenGraphics.drawImage(new TerminalPosition(22, 1), image);
    screenGraphics.drawImage(new TerminalPosition(28, 1), image, new TerminalPosition(1, 0), image.getSize());
    screenGraphics.drawImage(new TerminalPosition(33, 1), image, new TerminalPosition(2, 0), image.getSize());
    screenGraphics.drawImage(new TerminalPosition(37, 1), image, new TerminalPosition(3, 0), image.getSize());
    screenGraphics.drawImage(new TerminalPosition(40, 1), image, new TerminalPosition(4, 0), image.getSize());

    //Try to draw bigger than the image size, this should ignore the extra size
    screenGraphics.drawImage(new TerminalPosition(1, 7), image, TerminalPosition.TOP_LEFT_CORNER, image.getSize().withRelativeColumns(10));

    //0 size should draw nothing
    screenGraphics.drawImage(new TerminalPosition(8, 7), image, TerminalPosition.TOP_LEFT_CORNER, TerminalSize.ZERO);

    //Drawing with a negative source image offset will move the target position
    screenGraphics.drawImage(new TerminalPosition(8, 7), image, new TerminalPosition(-2, -2), image.getSize());

    screen.refresh();
    screen.readInput();
    screen.stopScreen();
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:50,代码来源:DrawImageTest.java


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