Package org.octabyte.fxshell

Source Code of org.octabyte.fxshell.SampleTerminalRunner

package org.octabyte.fxshell;

import org.octabyte.fxshell.terminal.command.CommandProcessor;

/**
* @author kobylsa on 06/02/14.
*/
public class SampleTerminalRunner extends SimpleTerminal {

    public SampleTerminalRunner() {
        super(500, 300);
        addCmdProcessor("blah", new CommandProcessor() {
            @Override
            public void onCommand(String cmd, String... cmdArgs) {
                // line without prompt
                getTermState().startNewLine("");
                getTermState().setLastLineText("blah-blah-blah");
                for(int i = 0; i != 10; ++i) {
                    getTermState().insertCharAtCursor('.');
                    try { Thread.sleep((int)(400 * Math.random())); } catch (Exception e) {
                        // ignore...
                    }
                }
                getTermState().insertStringAtCursor(" blah");
                // line with prompt
                getTermState().startNewLine();
            }
        });
    }

    public static void main(String... args) {
        launch(args);
    }
}
TOP

Related Classes of org.octabyte.fxshell.SampleTerminalRunner

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.