ucar.jpeg.jj2000.disp
Class ImgKeyListener
java.lang.Object
java.awt.event.KeyAdapter
ucar.jpeg.jj2000.disp.ImgKeyListener
- All Implemented Interfaces:
- KeyListener, EventListener
public class ImgKeyListener
- extends KeyAdapter
This class implements the listener for keyboard events for the JJ2000
decoder that displays in a ImgScrollPane.
The following key sequences are defined:
- : scroll image up
- : scroll image down
- : scroll image left
- : scroll image right
- : scroll image up by a vertical block increment
- : scroll image down by a vertical block increment
- 'Q' or 'q': exit the application
- '-': zoom out by 2
- '=' or '+': zoom in by 2
- '1': display at a zoom of 1
- 'Ctrl-C': exit the application
The amount by which the arrows scroll the image is determined by the
modifier keys. If the Ctrl key is held down, the block increment will be
used, otherwise the unit increment will. If the Shift key is held down then
the increment is multiplied by ACCEL_FACTOR. That is the Ctrl key selects
between unit and block increments, while the Shift key selects between
normal and accelerated mode.
Field Summary |
static int |
ACCEL_FACTOR
The acceleration factor when the shift key is pressed: 10 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ACCEL_FACTOR
public static final int ACCEL_FACTOR
- The acceleration factor when the shift key is pressed: 10
- See Also:
- Constant Field Values
ImgKeyListener
public ImgKeyListener(ImgScrollPane isp,
Decoder dec)
- Instantiate a new ImgKeyListener that will work on the specified
ImgScrollPane.
- Parameters:
isp
- The image scroll pane on which the actions should
operate.dec
- The decoder instance
keyPressed
public void keyPressed(KeyEvent evt)
- Hanldes the keyPressed events. Normal keys are not treated here because
some don't have a defined keycode (as incredible as it might seem!).
- Specified by:
keyPressed
in interface KeyListener
- Overrides:
keyPressed
in class KeyAdapter
- Parameters:
evt
- The key event to process.
keyTyped
public void keyTyped(KeyEvent evt)
- Handles the key typed event. Normal (i.e. "text") keys are handled
here.
- Specified by:
keyTyped
in interface KeyListener
- Overrides:
keyTyped
in class KeyAdapter
- Parameters:
evt
- The key event to process.
Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.