artisynth.core.renderables
Class HudKeyListener

java.lang.Object
  extended by artisynth.core.renderables.HudKeyListener
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener

public class HudKeyListener
extends java.lang.Object
implements java.awt.event.KeyListener

Class that listens to key events, and executes a scroll-up, scroll-down or fullscreen toggle for a HudPrintStream object.

Author:
Antonio

Field Summary
static artisynth.core.renderables.HudKeyListener.KeyCombo defaultFullscreenKeys
           
static artisynth.core.renderables.HudKeyListener.KeyCombo defaultScrollDownKeys
           
static artisynth.core.renderables.HudKeyListener.KeyCombo defaultScrollUpKeys
           
 
Constructor Summary
HudKeyListener(HudPrintStream hud)
          Creates a key listener for a HudPrintStream object
HudKeyListener(HudPrintStream hud, GLRenderer renderer)
          Creates a key listener for a HudPrintStream object
 
Method Summary
static HudKeyListener createListener(HudPrintStream hud, java.awt.Component comp)
          Creates and registers a HudKeyListener object
static HudKeyListener createListener(HudPrintStream hud, java.awt.Component comp, GLRenderer renderer)
          Creates and registers a HudKeyListener object
static HudKeyListener createListener(HudPrintStream hud, GLViewer viewer)
          Creates and registers a HudKeyListener object
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void setFullscreenCombo(int keyCode, char keyChar, int keyModifiers)
          Set key combination for toggling fullscreen, executed in the keyTyped event.
 void setScrollDownCombo(int keyCode, char keyChar, int keyModifiers)
          Set key combination for scrolling down, executed in the keyPressed event.
 void setScrollUpCombo(int keyCode, char keyChar, int keyModifiers)
          Set key combination for scrolling up, executed in the keyPressed event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultScrollUpKeys

public static artisynth.core.renderables.HudKeyListener.KeyCombo defaultScrollUpKeys

defaultScrollDownKeys

public static artisynth.core.renderables.HudKeyListener.KeyCombo defaultScrollDownKeys

defaultFullscreenKeys

public static artisynth.core.renderables.HudKeyListener.KeyCombo defaultFullscreenKeys
Constructor Detail

HudKeyListener

public HudKeyListener(HudPrintStream hud)
Creates a key listener for a HudPrintStream object

Parameters:
hud - the HudPrintStream object to control

HudKeyListener

public HudKeyListener(HudPrintStream hud,
                      GLRenderer renderer)
Creates a key listener for a HudPrintStream object

Parameters:
hud - the HudPrintStream object to control
renderer - (optional) a renderer use to trigger re-render events after changes
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

setScrollUpCombo

public void setScrollUpCombo(int keyCode,
                             char keyChar,
                             int keyModifiers)
Set key combination for scrolling up, executed in the keyPressed event. If either the keyCode or the keyChar match, and if the modifiers match, the command is executed.

Parameters:
keyCode - numeric code
keyChar - (optional) character
keyModifiers - modifiers

setScrollDownCombo

public void setScrollDownCombo(int keyCode,
                               char keyChar,
                               int keyModifiers)
Set key combination for scrolling down, executed in the keyPressed event. If either the keyCode or the keyChar match, and if the modifiers match, the command is executed.

Parameters:
keyCode - numeric code
keyChar - (optional) character
keyModifiers - modifiers

setFullscreenCombo

public void setFullscreenCombo(int keyCode,
                               char keyChar,
                               int keyModifiers)
Set key combination for toggling fullscreen, executed in the keyTyped event. If either the keyCode or the keyChar match, and if the modifiers match, the command is executed.

Parameters:
keyCode - numeric code
keyChar - (optional) character
keyModifiers - modifiers

createListener

public static HudKeyListener createListener(HudPrintStream hud,
                                            java.awt.Component comp)
Creates and registers a HudKeyListener object

Parameters:
hud - the HudPrintStream to control
comp - the component on which to listen for key events
Returns:
the created HudKeyListener

createListener

public static HudKeyListener createListener(HudPrintStream hud,
                                            java.awt.Component comp,
                                            GLRenderer renderer)
Creates and registers a HudKeyListener object

Parameters:
hud - the HudPrintStream to control
comp - the component on which to listen for key events
renderer - renderer object for triggering rerender events
Returns:
the created HudKeyListener

createListener

public static HudKeyListener createListener(HudPrintStream hud,
                                            GLViewer viewer)
Creates and registers a HudKeyListener object

Parameters:
hud - the HudPrintStream to control
viewer - the component on which to listen for key events/re-render
Returns:
the created HudKeyListener