## visad.java2d
Class KeyboardBehaviorJ2D

    java.lang.Object
      visad.java2d.KeyboardBehaviorJ2D

All Implemented Interfaces:
  KeyboardBehavior

public class KeyboardBehaviorJ2D
extends Object
implements KeyboardBehavior

KeyboardBehaviorJ2D is the VisAD class for keyboard control of translate (pan) and zoom in Java2D.

Field Summary
`static int` `ROTATE_Z_NEG` Identifier for function to rotate negatively around the Z viewing axis (perpendicular to the screen plane)
`static int` `ROTATE_Z_POS` Identifier for function to rotate positively around the Z viewing axis (perpendicular to the screen plane)

Fields inherited from interface visad.KeyboardBehavior
`NO_MASK, RESET, TRANSLATE_DOWN, TRANSLATE_LEFT, TRANSLATE_RIGHT, TRANSLATE_UP, ZOOM_IN, ZOOM_OUT`

Constructor Summary
`KeyboardBehaviorJ2D(DisplayRendererJ2D r)` Construct a new keyboard behavior for the DisplayRenderer.

Method Summary
`void` `execFunction(int function)` Executes the given function.
`void` `mapKeyToFunction(int function, int keycode, int modifiers)` Maps key represented by keycode & modifiers to the given function.
`void` `processKeyEvent(KeyEvent event)` Process a key event.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ROTATE_Z_POS

    public static final int ROTATE_Z_POS

  Identifier for function to rotate positively around the Z viewing axis (perpendicular to the screen plane)

  See Also:
    Constant Field Values

### ROTATE_Z_NEG

    public static final int ROTATE_Z_NEG

  Identifier for function to rotate negatively around the Z viewing axis (perpendicular to the screen plane)

  See Also:
    Constant Field Values

Constructor Detail

### KeyboardBehaviorJ2D

    public KeyboardBehaviorJ2D(DisplayRendererJ2D r)

  Construct a new keyboard behavior for the DisplayRenderer. You need to add the behavior to the DisplayRenderer if you want to use it. Default keys for manipulations are as follows:
  Translation
  - Arrow keys - translate up, down, left, right
  Zoom
  - Shift + Up arrow - zoom in (ZOOM_IN)
  - Shift + Down arrow - zoom out (ZOOM_OUT)
  Rotate
  - Shift + Left arrow - rotate left (ROTATE_Z_POS)
  - Shift + Right arrow - rotate right (ROTATE_Z_NEG)
  Reset
  - Ctrl + R key - reset to original projection (RESET)

Parameters:
  `r` - DisplayRenderer to use.
See Also:
  `DisplayRendererJ2D.addKeyboardBehavior(KeyboardBehaviorJ2D behavior)`

Method Detail

### mapKeyToFunction

    public void mapKeyToFunction(int function,
                                 int keycode,
                                 int modifiers)

  Maps key represented by keycode & modifiers to the given function. Each function can only have one key/modifier combination assigned to it at a time.

  Specified by:
    `mapKeyToFunction` in interface `KeyboardBehavior`
  Parameters:
    `function` - keyboard function (ROTATE_X_POS, ZOOM_IN, etc)
    `keycode` - `KeyEvent` virtual keycodes
    `modifiers` - `InputEvent` key mask
  See Also:
    `KeyEvent`, `InputEvent`

### processKeyEvent

    public void processKeyEvent(KeyEvent event)

  Process a key event. Determines whether a meaningful key was pressed.

  Specified by:
    `processKeyEvent` in interface `KeyboardBehavior`

### execFunction

    public void execFunction(int function)

  Executes the given function.

  Specified by:
    `execFunction` in interface `KeyboardBehavior`
  Parameters:
    `function` - function to perform (TRANSLATE_UP, ZOOM_IN, etc)