|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.event.ZNavEventHandlerKeyBoard
ZNavEventHandlerKeyBoard provides event handlers for basic zooming and panning of a Jazz camera with the keyboard. Applications can define which keys are used for navigation, and how much each key moves the camera.
The camera is changed a little bit with each keypress. If a key is held down so it auto-repeats, that is detected, and the camera will then be continuously moved in until the key is released, or another key is pressed at which point it will return to the original behavior of one increment per key press.
The default parameters are: PageUp zooms in PageDown zooms out Arrow keys pan Each keypress zooms in 25%, or pans 25% Each camera change is animated over 250 milliseconds The camera is zoomed around the cursor
Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.
Constructor Summary | |
ZNavEventHandlerKeyBoard(ZNode node,
ZCanvas canvas)
Constructs a new ZNavEventHandlerKeyBoard. |
Method Summary | |
boolean |
isActive()
Determines if this event handler is active. |
boolean |
isAutoNav()
Return true if currently auto-zooming |
void |
keyPressed(java.awt.event.KeyEvent e)
Key press event handler |
void |
keyReleased(java.awt.event.KeyEvent e)
Key release event handler |
void |
keyTyped(java.awt.event.KeyEvent e)
Key typed event handler |
void |
mouseDragged(ZMouseEvent e)
Watch mouse motion so we always know where the mouse is. |
void |
mouseMoved(ZMouseEvent e)
Watch mouse motion so we always know where the mouse is. |
void |
navOneStep()
Implements auto-navigation |
void |
setActive(boolean active)
Specifies whether this event handler is active or not. |
void |
setHomeKey(int homeKey)
Define the key that is used to home. |
void |
setMaxMagnification(double newMaxMag)
Set the maximum magnification that the camera can be set to with this event handler. |
void |
setMinMagnification(double newMinMag)
Set the minimum magnification that the camera can be set to with this event handler. |
void |
setPanKeys(int leftKey,
int rightKey,
int upKey,
int downKey)
Define the keys that are used to pan. |
void |
setZoomCenter(int x,
int y)
Specify the point (in screen coordinates) that the camera will be zoomed about. |
void |
setZoomKeys(int inKey,
int outKey)
Define the keys that are used to zoom. |
void |
startAutoNav()
Start the auto navigation |
void |
stopAutoNav()
Stops the auto navigation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZNavEventHandlerKeyBoard(ZNode node, ZCanvas canvas)
node
- The node this event handler attaches to.canvas
- The canvas this event handler attaches toMethod Detail |
public void setActive(boolean active)
setActive
in interface ZEventHandler
active
- True to make this event handler activepublic boolean isActive()
isActive
in interface ZEventHandler
public void setZoomKeys(int inKey, int outKey)
inKey
- The keycode of the key that should trigger zoom in events.outKey
- The keycode of the key that should trigger zoom out events.public void setPanKeys(int leftKey, int rightKey, int upKey, int downKey)
leftKey
- The keycode of the key that should trigger pan left events.rightKey
- The keycode of the key that should trigger pan right events.upKey
- The keycode of the key that should trigger pan up events.downKey
- The keycode of the key that should trigger pan down events.public void setHomeKey(int homeKey)
homeKey
- The keycode of the key that should trigger the home event.public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
e
- The event.public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
e
- The event.public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
e
- The event.public void mouseMoved(ZMouseEvent e)
mouseMoved
in interface ZMouseMotionListener
public void mouseDragged(ZMouseEvent e)
mouseDragged
in interface ZMouseMotionListener
public void setZoomCenter(int x, int y)
x,y
- Screen coordinates of zoom centerpublic boolean isAutoNav()
public void startAutoNav()
public void stopAutoNav()
public void setMinMagnification(double newMinMag)
newMinMag
- the new minimum magnificationpublic void setMaxMagnification(double newMaxMag)
newMaxMag
- the new maximum magnificationpublic void navOneStep()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |