Why does my InputHandler not work?

Hi.



I use a JCanvasImplementor, NOT any AbstractGame class. So I try to init all InputHandlers

What is wrong with this code?



Thanks,

Equilibrium


 MouseInput.setProvider(InputSystem.INPUT_SYSTEM_LWJGL);
            KeyInput.setProvider(InputSystem.INPUT_SYSTEM_LWJGL);
            InputHandler inputHandler = new InputHandler();

            InputAction inputAction = new InputAction() {

                public void performAction(InputActionEvent evt) {
                    System.out.println("This should be printed if space is pressed, but isn't. Why?");
                }
            };

            KeyBindingManager keyboard = KeyBindingManager.getKeyBindingManager();
            keyboard.set("space", KeyInput.KEY_SPACE);
            inputHandler.addAction(inputAction, "space", false);

            inputHandler.setEnabled(true);

do  you update() your inputHandler in your game loop ?

yes, I did. Thanks, I already found the solution. I had to add the (MouseListener)MouseInput.getKey(); to the canvas. By the way. how to do



(MouseMotionListener)MouseInput.getKey();



?



Thanks