if ( KeyBindingManager.getKeyBindingManager().isValidCommand("toggle_pause", false ) ) {
System.out.println("P");
}
}
In my code, everytime V is pressed, i set a global boolean so my renderer knows when to repopulate the graphics nodes (In this case its calls a function to switch Vertex on or off, depending on previous state). But everytime i press the key, the input listener is called twice, i Can see the vertex removed and than redraw again.
It should be called twice, once for pressing the ke, once for releasing. But it seems you noticed that. Did you probably register that listener more than once?
// add a listener... if window is resized, we can do something about it.
glCanvas.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent ce) {
doResize();
}
});
if(model == null)
return null;
input = new InputHandler();
glCanvas.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent arg0) {
((AWTKeyInput) KeyInput.get()).setEnabled(true);
((AWTMouseInput) MouseInput.get()).setEnabled(true);
}
public void focusLost(FocusEvent arg0) {
((AWTKeyInput) KeyInput.get()).setEnabled(false);
((AWTMouseInput) MouseInput.get()).setEnabled(false);
}