universe.world.test
Class StopTest.MousePointsWorld
java.lang.Object
universe.world.VoidWorld<java.lang.String>
universe.world.test.StopTest.MousePointsWorld
- Enclosing class:
- StopTest
public static class StopTest.MousePointsWorld
- extends VoidWorld<java.lang.String>
Fields inherited from class universe.world.VoidWorld |
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[] args)
|
Scene |
onDraw()
Return a visualization of this VoidWorld as a Scene . |
VoidPackage<java.lang.String> |
onKey(java.lang.String me)
Change this VoidWorld (and produce a VoidPackage
possibly containing a message) when a key event is
triggered. |
VoidPackage<java.lang.String> |
onMouse(int x,
int y,
java.lang.String me)
Change this VoidWorld (and produce a VoidPackage
possibly containing a message) when a mouse event is triggered. |
boolean |
stopWhen()
Determine if the World/interaction/animation should be
stopped. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
main
public static void main(java.lang.String[] args)
onDraw
public Scene onDraw()
- Description copied from class:
VoidWorld
- Return a visualization of this VoidWorld 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 VoidWorld<java.lang.String>
onMouse
public VoidPackage<java.lang.String> onMouse(int x,
int y,
java.lang.String me)
- Description copied from class:
VoidWorld
- Change this VoidWorld (and produce a VoidPackage
possibly containing a message) when a mouse event is triggered.
x and y are the location of the event in the
window, and event is a String that describes
what kind of event occurred.
Possible Mouse Events
"button-down" : |
The user presses a mouse button in the VoidWorld window |
"button-up" : |
The user releases a mouse button in the VoidWorld window |
"move" : |
The user moves the mouse in the VoidWorld window |
"drag" : |
The user holds a mouse button and moves the mouse in the VoidWorld window |
"enter" : |
The user moves the mouse in-to the VoidWorld window |
"leave" : |
The user moves the mouse out-of the VoidWorld window |
- Overrides:
onMouse
in class VoidWorld<java.lang.String>
stopWhen
public boolean stopWhen()
- Description copied from class:
VoidWorld
- Determine if the World/interaction/animation should be
stopped. Returning a value of true
discontinues all events (mouse, key, ticks) and causes
VoidWorld.lastScene()
to be used to draw the final
Scene.
- Overrides:
stopWhen
in class VoidWorld<java.lang.String>
onKey
public VoidPackage<java.lang.String> onKey(java.lang.String me)
- Description copied from class:
VoidWorld
- Change this VoidWorld (and produce a VoidPackage
possibly containing a message) when a key event is
triggered. The given event is a String that
describes which key was pressed.
Special Key
"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 VoidWorld<java.lang.String>