Package snap.viewx

Class ConsoleView

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class ConsoleView extends TextArea
A TextView subclass with methods to act like a terminal/console.
  • Constructor Details

    • ConsoleView

      public ConsoleView()
      Creates new ConsoleView.
  • Method Details

    • getPrompt

      public String getPrompt()
      Returns the prompt.
    • setPrompt

      public void setPrompt(String aPrompt)
      Sets the prompt.
    • getInputLocation

      public int getInputLocation()
      Returns the location of the end of the last text appended to console.
    • keyPressed

      protected void keyPressed(ViewEvent anEvent)
      Handles key events.
      Overrides:
      keyPressed in class TextArea
    • keyTyped

      protected void keyTyped(ViewEvent anEvent)
      Called when a key is typed.
      Overrides:
      keyTyped in class TextArea
    • processEnterAction

      protected void processEnterAction()
      Called when enter is hit.
    • append

      public void append(String aString)
      Appends a string.
    • replaceChars

      public void replaceChars(String aString, TextStyle aStyle, int aStart, int anEnd, boolean doUpdateSel)
      Override to update input location.
      Overrides:
      replaceChars in class TextArea
    • getInput

      public String getInput()
      Gets input String from console starting at current input location.
    • executeCommand

      public String executeCommand(String aCommand)
      Executes command.
    • executeCommandImpl

      protected String executeCommandImpl(String aCommand)
      Executes command.
    • executeHelp

      public String executeHelp(String aCommand)
      Execute a help command.
    • executePrint

      public String executePrint(String aCommand)
      Executes a print command.
    • clearConsole

      public void clearConsole()
      Clears the console.
    • setCommandHistoryPrevious

      public void setCommandHistoryPrevious()
      Sets a command from history.
    • setCommandHistoryNext

      public void setCommandHistoryNext()
      Sets a command from history.