MessagePasser class



This class enables the passing of String objects (i.e. messages, commands, etc.) to and from an instantiation of the Robot class. This allows you to interact with your controller when its being executed in the simulator, without having to mess around with standard I/O streams to and from a terminal window (although you can use this method if you like).


Methods

void postMessage(String message) - accepts a valid String, which is then appended to the Output text area on the simulator GUI. Strings can be literals or references to existing String objects. The String argument need not be terminated with a newline character. This method returns immediately.
String getMessage() - returns a String represention of the text entered in the Input text field on the simulator GUI. This value may be null if no text is entered. This method only returns when the Enter key is pressed while the Input text field has focus. In this way it behaves much like BufferedReader's readline() method, which blocks until the user hits Enter.

Back Home