anchor.diff:        }
       }
     };
  -}
  -
  -----
  -
  -Build and run the example.
  -
  -*  Press the Spacebar or click to rotate the cube. 
  -*  Press the J and K keys to move the cube.
  -*  Press P to pause and unpause the game. While paused, the game should not respond to any input, other than `P`.
  -
  -
  -== Defining Mappings and Triggers
  -
  -First you register each mapping name with its trigger(s). Remember the following:
  -
  -*  An input trigger can be a key press or mouse action. +
  -For example a mouse movement, a mouse click, or pressing the letter “P.
  -*  The mapping name is a string that you can choose. +
  -The name should describe the action (e.g. “Rotate), and not the trigger. Because the trigger can change.
  -*  One named mapping can have several triggers. +
  -For example, the “Rotate action can be triggered by a click and by pressing the spacebar.
  -
  -Have a look at the code:
  -
  -.  You register the mapping named “Rotate to the Spacebar key trigger. +
  -`new KeyTrigger(KeyInput.KEY_SPACE)`). 
  -.  In the same line, you also register “Rotate to an alternative mouse click trigger. +
  -`new MouseButtonTrigger(MouseInput.BUTTON_LEFT)`
  -.  You map the `Pause`, `Left`, `Right` mappings to the P, J, K keys, respectively. 
  -+
  -[source,java]
  -----
  -
  -    // You can map one or several inputs to one named action
  -    inputManager.addMapping("Pause",  new KeyTrigger(KeyInput.KEY_P));
  -    inputManager.addMapping("Left",   new KeyTrigger(KeyInput.KEY_J));
  -    inputManager.addMapping("Right",  new KeyTrigger(KeyInput.KEY_K));
  -    inputManager.addMapping("Rotate", new KeyTrigger(KeyInput.KEY_SPACE),
  -                                      new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
  -
  -----
  -
  -Now you need to register your trigger mappings.
  -
  -.  You register the pause action to the ActionListener, because it is an “on/off action.
  -.  You register the movement actions to the AnalogListener, because they are gradual actions.
  -+
  -[source,java]
  -----
  -
  -    // Add the names to the action listener.
  -    inputManager.addListener(actionListener,"Pause");
  -    inputManager.addListener(analogListener,"Left", "Right", "Rotate");
  -
  -----
  -
  -This code goes into the `simpleInitApp()` method. But since we will likely add many keybindings, we extract these lines and wrap them in an auxiliary method, `initKeys()`. The `initKeys()` method is not part of the Input Controls interface – you can name it whatever you like. Just don't forget to call your method from the `initSimpleApp()` method.
  -
  -
  -== Implementing the Actions
  -
  -You have mapped action names to input triggers. Now you specify the actions themselves.
  -
  -The two important methods here are the `ActionListener` with its `onAction()` method, and the `AnalogListener` with its `onAnalog()` method. In these two methods, you test for each named mapping, and call the game action you want to trigger. 
  -
  -In this example, we trigger the following actions: 
  -
  -.  The _Rotate_ mapping triggers the action `player.rotate(0, value, 0)`. 
  -.  The _Left_ and _Right_ mappings increase and decrease the player's x coordinate. 
  -.  The _Pause_ mapping flips a boolean `isRunning`. 
  -.  We also want to check the boolean `isRunning` before any action (other than unpausing) is executed.
  -
  -[source,java]
  -----
  -
  -  private ActionListener actionListener = new ActionListener() {
  +----
  +
  +You can also combine both listeners into one, the engine will send the appropriate events to each method (onAction or onAnalog). For example:
  +
  +[source,java]
  +----
  +
  +  private MyCombinedListener combinedListener = new MyCombinedListener();
  +
  +  private static class MyCombinedListener implements AnalogListener, ActionListener {
       public void onAction(String name, boolean keyPressed, float tpf) {
         if (name.equals("Pause") && !keyPressed) {
           isRunning = !isRunning;
         }
       }
  -  };
  -
  -  private AnalogListener analogListener = new AnalogListener() {
  +
       public void onAnalog(String name, float value, float tpf) {
         if (isRunning) {
           if (name.equals("Rotate")) {
  
positive.code:         System.out.println("Press P to unpause.");
        }
      }
    };
  ----
  
  You can also combine both listeners into one, the engine will send the appropriate events to each method (onAction or onAnalog). For example:
  
  [source,java]
  ----
  
    private MyCombinedListener combinedListener = new MyCombinedListener();
  
    private static class MyCombinedListener implements AnalogListener, ActionListener {
      public void onAction(String name, boolean keyPressed, float tpf) {
        if (name.equals("Pause") && !keyPressed) {
          isRunning = !isRunning;
        }
      }
      
      public void onAnalog(String name, float value, float tpf) {
        if (isRunning) {
          if (name.equals("Rotate")) {
            player.rotate(0, value*speed, 0);
          }
          if (name.equals("Right")) {
            Vector3f v = player.getLocalTranslation();
            player.setLocalTranslation(v.x + value*speed, v.y, v.z);
          }
          if (name.equals("Left")) {
            Vector3f v = player.getLocalTranslation();
            player.setLocalTranslation(v.x - value*speed, v.y, v.z);
          }
        } else {
          System.out.println("Press P to unpause.");
        }
      }
    }
  // ...
  inputManager.addListener(combinedListener, new String[]{"Pause", "Left", "Right", "Rotate"});
    
  ----
  
  It's okay to use only one of the two Listeners, and not implement the other one, if you are not using this type of interaction. In the following, we have a closer look how to decide which of the two listeners is best suited for which situation.
  
negative.code: import com.jme3.input.controls.KeyTrigger;
  import com.jme3.input.controls.MouseButtonTrigger;
  
  /**
   * Sample 5 - how to map keys and mousebuttons to actions
   */
  public class HelloInput extends SimpleApplication {
  
      public static void main(String[] args) {
          HelloInput app = new HelloInput();
          app.start();
      }
      protected Geometry player;
      Boolean isRunning = true;
  
      @Override
      public void simpleInitApp() {
          Box b = new Box(1, 1, 1);
          player = new Geometry("Player", b);
          Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
          mat.setColor("Color", ColorRGBA.Blue);
          player.setMaterial(mat);
          rootNode.attachChild(player);
          initKeys(); // load my custom keybinding
      }
  
      /**
       * Custom Keybinding: Map named actions to inputs.
       */
      private void initKeys() {
          // You can map one or several inputs to one named action
          inputManager.addMapping("Pause",  new KeyTrigger(KeyInput.KEY_P));
          inputManager.addMapping("Left",   new KeyTrigger(KeyInput.KEY_J));
          inputManager.addMapping("Right",  new KeyTrigger(KeyInput.KEY_K));
          inputManager.addMapping("Rotate", new KeyTrigger(KeyInput.KEY_SPACE),
                                            new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
          // Add the names to the action listener.
          inputManager.addListener(actionListener, "Pause");
          inputManager.addListener(analogListener, "Left", "Right", "Rotate");
  
      }
  
      private final ActionListener actionListener = new ActionListener() {
          @Override
          public void onAction(String name, boolean keyPressed, float tpf) {
              if (name.equals("Pause") && !keyPressed) {
                  isRunning = !isRunning;
              }
          }
      };
  
      private final AnalogListener analogListener = new AnalogListener() {
          @Override
          public void onAnalog(String name, float value, float tpf) {
              if (isRunning) {
                  if (name.equals("Rotate")) {
                      player.rotate(0, value * speed, 0);
                  }
                  if (name.equals("Right")) {
                      Vector3f v = player.getLocalTranslation();
                      player.setLocalTranslation(v.x + value * speed, v.y, v.z);
                  }
                  if (name.equals("Left")) {
                      Vector3f v = player.getLocalTranslation();
                      player.setLocalTranslation(v.x - value * speed, v.y, v.z);
                  }
              } else {
                  System.out.println("Press P to unpause.");
              }
          }
      };
  }
  
  ----
  
  Build and run the example.
  
  *  Press the Spacebar or click to rotate the cube.
  *  Press the J and K keys to move the cube.
  *  Press P to pause and unpause the game. While paused, the game should not respond to any input, other than `P`.
  
  
  == Defining Mappings and Triggers
  
  First you register each mapping name with its trigger(s). Remember the following:
  
  *  An input trigger can be a key press or mouse action. +
  For example a mouse movement, a mouse click, or pressing the letter “P.
  *  The mapping name is a string that you can choose. +
  The name should describe the action (e.g. “Rotate), and not the trigger. Because the trigger can change.
  *  One named mapping can have several triggers. +
  For example, the “Rotate action can be triggered by a click and by pressing the spacebar.
  
  Have a look at the code:
  
  .  You register the mapping named “Rotate to the Spacebar key trigger. +
  `new KeyTrigger(KeyInput.KEY_SPACE)`).
  .  In the same line, you also register “Rotate to an alternative mouse click trigger. +
  `new MouseButtonTrigger(MouseInput.BUTTON_LEFT)`
  .  You map the `Pause`, `Left`, `Right` mappings to the P, J, K keys, respectively.
  +
  [source,java]
  ----
  
      // You can map one or several inputs to one named action
      inputManager.addMapping("Pause",  new KeyTrigger(KeyInput.KEY_P));
      inputManager.addMapping("Left",   new KeyTrigger(KeyInput.KEY_J));
      inputManager.addMapping("Right",  new KeyTrigger(KeyInput.KEY_K));
      inputManager.addMapping("Rotate", new KeyTrigger(KeyInput.KEY_SPACE),
                                        new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
  
  ----
  
  Now you need to register your trigger mappings.
  
  .  You register the pause action to the ActionListener, because it is an “on/off action.
  .  You register the movement actions to the AnalogListener, because they are gradual actions.
  +
  [source,java]
  ----
  
      // Add the names to the action listener.
      inputManager.addListener(actionListener,"Pause");
      inputManager.addListener(analogListener,"Left", "Right", "Rotate");
  
  ----
  
  This code goes into the `simpleInitApp()` method. But since we will likely add many keybindings, we extract these lines and wrap them in an auxiliary method, `initKeys()`. The `initKeys()` method is not part of the Input Controls interface – you can name it whatever you like. Just don't forget to call your method from the `initSimpleApp()` method.
  
  
  == Implementing the Actions
  
  You have mapped action names to input triggers. Now you specify the actions themselves.
  
  The two important methods here are the `ActionListener` with its `onAction()` method, and the `AnalogListener` with its `onAnalog()` method. In these two methods, you test for each named mapping, and call the game action you want to trigger.
  
  In this example, we trigger the following actions:
  
  .  The _Rotate_ mapping triggers the action `player.rotate(0, value, 0)`.
  .  The _Left_ and _Right_ mappings increase and decrease the player's x coordinate.
  .  The _Pause_ mapping flips a boolean `isRunning`.
  .  We also want to check the boolean `isRunning` before any action (other than unpausing) is executed.
  
  [source,java]
  ----
  
    private ActionListener actionListener = new ActionListener() {
      public void onAction(String name, boolean keyPressed, float tpf) {
  