How do I add multiple inputhandlers to a jmedesktop?

I have a game in which I use multiple inputhandlers… One for first-person "aiming", one for GUI functionality.  When I register the jmedesktop using setup, I specify one of those two.  How do I change to another later on in my code? 

The API docs say I can set it initially to null to "provide custom input handling or later adding of InputHandler(s)"

But I don't see how I can add them later.


OK I just noticed, the keyboard input I type while under the second inputhandler is either queued up, or is going to the jmedesktop but not displayed.  When I swap back to the original, the text I typed earlier is displayed. 

So how do I force the components or jmedesktop to update when its not getting invoked by the input.update(interpolation) ?

You could always add one inputhandler to another?

I did manage to fumble into trying that, but then the camera pans around while I'm in GUI mode, clicking buttons…

I donno if I made a mess of things or not by using two imput handlers;  it seemed like the only way at the time.  In my game, you play like an RTS, mouse movement to pick units and move them. (InputHandler) If you hold the middle mouse button, you can "free look" around.  (FirstPersonHandler)  While middle mouse is down I stop updating input and start updating fpinput.

protected FirstPersonHandler fpinput;
    protected InputHandler input;

Possible solutions:
1) While in first person mode, can I process *just* the keyboard input of the original inputhandler that was registered to the jmedesktop?
2) Instead of using 2 handlers, can I convert input into a firstpersonhandler on the fly, and then back again?  Potentially quite often?

Using 2 handlers is fine. Just don't ommit the update calls but disable them instead.

Thanks!  After much gnashing of teeth I got it to work while both inputhandlers are updating, but disabling the one I don't want active.  In case anyone else has this problem, remember to actually disable the mouselookhandler, not the input handler:

fpinput.getMouseLookHandler().setEnabled(false);    //GOOD

fpinput.setEnabled(false);                                        //bad