public class ImgKeyListener extends KeyAdapter
The following key sequences are defined:
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.
-
-
-
-
-
-
- '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
| Modifier and Type | Field and Description |
|---|---|
static int |
ACCEL_FACTOR
The acceleration factor when the shift key is pressed: 10
|
| Constructor and Description |
|---|
ImgKeyListener(ImgScrollPane isp,
Decoder dec)
Instantiate a new ImgKeyListener that will work on the specified
ImgScrollPane.
|
| Modifier and Type | Method and Description |
|---|---|
void |
keyPressed(KeyEvent evt)
Hanldes the keyPressed events.
|
void |
keyTyped(KeyEvent evt)
Handles the key typed event.
|
keyReleasedpublic static final int ACCEL_FACTOR
public ImgKeyListener(ImgScrollPane isp, Decoder dec)
isp - The image scroll pane on which the actions should
operate.dec - The decoder instancepublic void keyPressed(KeyEvent evt)
keyPressed in interface KeyListenerkeyPressed in class KeyAdapterevt - The key event to process.public void keyTyped(KeyEvent evt)
keyTyped in interface KeyListenerkeyTyped in class KeyAdapterevt - The key event to process.Copyright © 2015. All rights reserved.