public void keyReleased(KeyEvent e) { int code = e.getKeyCode(); if (code > 0 && code < keys.length) { keys[code] = false; } if (externalListener != null) { externalListener.keyReleased(e); } }
private void fireKeyEvent(KeyEvent e) { for (KeyListener l : mKeyListeners) { if (e.getID() == KeyEvent.KEY_PRESSED) { l.keyPressed(e); } else if (e.getID() == KeyEvent.KEY_RELEASED) { l.keyReleased(e); } else if (e.getID() == KeyEvent.KEY_TYPED) { l.keyTyped(e); } } }
void notifyKeyEvent(final KeyEvent e) { for (KeyListener l : myKeyListeners) { if (e.getID() == KeyEvent.KEY_PRESSED) { l.keyPressed(e); } else if (e.getID() == KeyEvent.KEY_RELEASED) { l.keyReleased(e); } else if (e.getID() == KeyEvent.KEY_TYPED) { l.keyTyped(e); } } }
protected void processKeyEvent(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { EventListener[] el = super.getListeners(KeyListener.class); if (e.getID() != KeyEvent.KEY_RELEASED) return; for (int i = 0; i < el.length; i++) { KeyListener kl = (KeyListener) el[i]; kl.keyReleased(e); } return; } super.processKeyEvent(e); }
private static void dispatchEvent(int eventCode, Key key, int keyCode, Component component) { int modifier = key.getModifier().getCode(); KeyEvent event = new KeyEvent(component, eventCode, 0, modifier, keyCode, key.getChar()); for (KeyListener listener : component.getKeyListeners()) { switch (eventCode) { case KEY_PRESSED: listener.keyPressed(event); break; case KEY_TYPED: listener.keyTyped(event); break; case KEY_RELEASED: listener.keyReleased(event); break; } } SwingUtilities.processKeyBindings(event); }
/** * Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b. * * @param e the key event */ public void keyReleased(KeyEvent e) { ((KeyListener) a).keyReleased(e); ((KeyListener) b).keyReleased(e); }