private void initKeys() {
    inputManager.addMapping("Walk", new KeyTrigger(KeyInput.KEY_SPACE));

    ActionListener handler = new ActionListener() {
      @Override
      public void onAction(String name, boolean keyPressed, float tpf) {
        if (keyPressed && control.getCurrentAction() != advance) {
          control.setCurrentAction("advance");
        }
      }
    };
    inputManager.addListener(handler, "Walk");
  }
Map the spacebar to the "Walk" input action, and add a listener to initiate
the "advance" animation action each time it's pressed.
jme3-examples/src/main/java/jme3test/helloworld/HelloAnimation.java