Class KeyNavigatorBehavior

All Implemented Interfaces:
KeyListener, EventListener

public class KeyNavigatorBehavior extends Behavior implements KeyListener
This class is a simple behavior that invokes the KeyNavigator to modify the view platform transform.
  • Constructor Details

    • KeyNavigatorBehavior

      public KeyNavigatorBehavior(TransformGroup targetTG)
      Constructs a new key navigator behavior node that operates on the specified transform group.
      Parameters:
      targetTG - the target transform group
    • KeyNavigatorBehavior

      public KeyNavigatorBehavior(Component c, TransformGroup targetTG)
      Constructs a key navigator behavior that uses AWT listeners and behavior posts rather than WakeupOnAWTEvent. The behavior is added to the specified Component and works on the given TransformGroup. A null component can be passed to specify the behavior should use listeners. Components can then be added to the behavior with the addListener(Component c) method.
      Parameters:
      c - The component to add the KeyListener to.
      targetTG - The target transform group.
      Since:
      Java 3D 1.2.1
  • Method Details

    • initialize

      public void initialize()
      Override Behavior's initialize method to setup wakeup criteria.
      Specified by:
      initialize in class Behavior
    • processStimulus

      public void processStimulus(Enumeration criteria)
      Override Behavior's stimulus method to handle the event.
      Specified by:
      processStimulus in class Behavior
      Parameters:
      criteria - an enumeration of triggered wakeup criteria for this behavior
    • addListener

      public void addListener(Component c)
      Adds this behavior as a KeyListener to the specified component. This method can only be called if the behavior was created with one of the constructors that takes a Component as a parameter.
      Parameters:
      c - The component to add the KeyListener to.
      Throws:
      IllegalStateException - if the behavior was not created as a listener
      Since:
      Java 3D 1.2.1
    • keyPressed

      public void keyPressed(KeyEvent evt)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent evt)
      Specified by:
      keyReleased in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent evt)
      Specified by:
      keyTyped in interface KeyListener