Class KeyNavigator


  • public class KeyNavigator
    extends java.lang.Object
    This is the KeyNavigator class. It accumulates AWT key events (key press and key release) and computes a new transform based on the accumulated events and elapsed time.
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyNavigator​(TransformGroup targetTG)
      Constructs a new key navigator object that operates on the specified transform group.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void integrateTransformChanges()
      Computes a new transform for the next frame based on the current transform, accumulated keyboard inputs, and elapsed time.
      void processKeyEvent​(java.awt.event.KeyEvent keyEvent)
      Processed a keyboard event.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KeyNavigator

        public KeyNavigator​(TransformGroup targetTG)
        Constructs a new key navigator object that operates on the specified transform group. All parameters are set to their default, idle state.
        Parameters:
        targetTG - the target transform group
    • Method Detail

      • integrateTransformChanges

        public void integrateTransformChanges()
        Computes a new transform for the next frame based on the current transform, accumulated keyboard inputs, and elapsed time. This new transform is written into the target transform group. This method should be called once per frame.
      • processKeyEvent

        public void processKeyEvent​(java.awt.event.KeyEvent keyEvent)
        Processed a keyboard event. This routine should be called every time a KEY_PRESSED or KEY_RELEASED event is received.
        Parameters:
        keyEvent - the AWT key event