org.proteinshader.gui.listeners
Class CanvasKeyListener

java.lang.Object
  extended by org.proteinshader.gui.listeners.CanvasKeyListener
All Implemented Interfaces:
KeyListener, EventListener

public class CanvasKeyListener
extends Object
implements KeyListener

Responds to keyboard shortcuts when the canvas has the focus.
Currently, the keyboard shortcuts are only for zooming the camera in or out 5 angstroms at a time or for printing camera distances to the monitor (see the comments for the keyTyped() method).


Constructor Summary
CanvasKeyListener(Mediator mediator, Renderer renderer, GLCanvas canvas)
          Constructs a CanvasKeyListener.
 
Method Summary
 void keyPressed(KeyEvent e)
          This KeyListener interface method is not needed.
 void keyReleased(KeyEvent e)
          This KeyListener interface method is not needed.
 void keyTyped(KeyEvent e)
          Moves the z coordinate for the camera and then redraws the canvas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanvasKeyListener

public CanvasKeyListener(Mediator mediator,
                         Renderer renderer,
                         GLCanvas canvas)
Constructs a CanvasKeyListener. This listener needs the address of the Renderer and the canvas to draw on.

Parameters:
mediator - the central Mediator that allows communication with the GUI classes.
renderer - the Renderer for the canvas of the main GUI.
canvas - the canvas of the main GUI.
Method Detail

keyTyped

public void keyTyped(KeyEvent e)
Moves the z coordinate for the camera and then redraws the canvas.

Shortcut keys:

M - toggles motion (constant rotation) between on and off
D - toggles printing of object camera distance and auto tiling number
i or I - zoom camera In (camera moves 5 anstroms in -z direction)
o or O - zoom camera Out (camera moves 5 angstroms in +z direction)

Specified by:
keyTyped in interface KeyListener
Parameters:
e - the key event.

keyPressed

public void keyPressed(KeyEvent e)
This KeyListener interface method is not needed.

Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent e)
This KeyListener interface method is not needed.

Specified by:
keyReleased in interface KeyListener


Copyright © 2007-2008