How to use KeyBindingManager with SimpleApplet?

I'm trying to set custom keys to some actions in my first jME2 applet, but can't get it working.

Is there something wrong with these:



public void simpleInitGame() {
    KeyBindingManager.getKeyBindingManager().set("camUp", KeyInput.KEY_T);
    KeyBindingManager.getKeyBindingManager().set("camDown", KeyInput.KEY_G);
}
public void simpleUpdate() {
    if (KeyBindingManager.getKeyBindingManager().isValidCommand("camUp",false)){
        //cam up
    }
    if (KeyBindingManager.getKeyBindingManager().isValidCommand("camDown",false)){
        //cam down
    }
}

That should work, but KEY_T is already used to toggle Wirewrame in BaseSimpleApplet


I think you must remove all default keys before set your own (don't forget to set an EXIT key).

sebcap26 said:

I think you must remove all default keys before set your own (don't forget to set an EXIT key).


I changed the code this way


        KeyBindingManager.getKeyBindingManager().removeAll();
        KeyBindingManager.getKeyBindingManager().set("camUp", KeyInput.KEY_O);
        KeyBindingManager.getKeyBindingManager().set("camDown", KeyInput.KEY_L);



and it works fine now. Thanks!  :)