universe.test
Class ShowKey

java.lang.Object
  extended by universe.world.World<java.lang.String>
      extended by universe.test.ShowKey

public class ShowKey
extends World<java.lang.String>

Universe/World OnKey test. Sends the key string to the server, which responds by wrapping the given key in parentheses: "("+key+")"


Field Summary
 
Fields inherited from class universe.world.World
DEFAULT_TICK_RATE, KEY_ARROW_DOWN, KEY_ARROW_LEFT, KEY_ARROW_RIGHT, KEY_ARROW_UP, MOUSE_DOWN, MOUSE_DRAG, MOUSE_ENTER, MOUSE_LEAVE, MOUSE_MOVE, MOUSE_UP
 
Method Summary
static void main(java.lang.String[] s)
           
 Scene onDraw()
          Return a visualization of this World as a Scene.
 Package<java.lang.String> onKey(java.lang.String ke)
          Produce a Package, containing a (possibly) new World and a possible Message, when a key is pressed.
 Package<java.lang.String> onReceive(java.lang.String msg)
          Produce a Package, containing a (possibly) new World and a possible Message, when a message from the universe is received.
 
Methods inherited from class universe.world.World
bigBang, bigBang, lastScene, onMouse, onRelease, onTick, stopWhen, tickRate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] s)

onKey

public Package<java.lang.String> onKey(java.lang.String ke)
Description copied from class: World
Produce a Package, containing a (possibly) new World and a possible Message, when a key is pressed. The given event is a String that describes what key was pressed.

Special Keys

"up" : The user presses the up-arrow key
"down" : The user presses the down-arrow key
"left" : The user presses the left-arrow key
"right" : The user presses the right-arrow key
Other keys generate a single character String that represents the key pressed. For example, Pressing the B key on the keyboard generates "b" as an event. If the shift key is held while pressing B then "B" is generated.

Overrides:
onKey in class World<java.lang.String>

onDraw

public Scene onDraw()
Description copied from class: World
Return a visualization of this World as a Scene. See EmptyScene, Scene.placeImage(Image, int, int), and Scene.addLine(int, int, int, int, String) for documentation on constructing Scenes

Specified by:
onDraw in class World<java.lang.String>

onReceive

public Package<java.lang.String> onReceive(java.lang.String msg)
Description copied from class: World
Produce a Package, containing a (possibly) new World and a possible Message, when a message from the universe is received.

Overrides:
onReceive in class World<java.lang.String>