Java Code Examples for java.awt.event.KeyListener#keyReleased()
The following examples show how to use
java.awt.event.KeyListener#keyReleased() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyBindingOverrideKeyEventDispatcher.java From ghidra with Apache License 2.0 | 8 votes |
private boolean processComponentKeyListeners(KeyEvent keyEvent) { Component focusOwner = focusProvider.getFocusOwner(); if (focusOwner == null) { return false; } KeyListener[] keyListeners = focusOwner.getKeyListeners(); for (KeyListener listener : keyListeners) { int id = keyEvent.getID(); switch (id) { case KeyEvent.KEY_TYPED: listener.keyTyped(keyEvent); break; case KeyEvent.KEY_PRESSED: listener.keyPressed(keyEvent); break; case KeyEvent.KEY_RELEASED: listener.keyReleased(keyEvent); break; } } return keyEvent.isConsumed(); }
Example 2
Source File: WatchesColumnModels.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void processKeyEvent(KeyEvent e) { KeyStroke ks = KeyStroke.getKeyStrokeForEvent(e); if (enter.equals(ks)) { // Prevent JComponent.processKeyBindings() to be called (it is called from // JComponent.processKeyEvent() ), notify only registered key listeners int id = e.getID(); for (KeyListener keyListener : getKeyListeners()) { switch(id) { case KeyEvent.KEY_TYPED: keyListener.keyTyped(e); break; case KeyEvent.KEY_PRESSED: keyListener.keyPressed(e); break; case KeyEvent.KEY_RELEASED: keyListener.keyReleased(e); break; } } if (!e.isConsumed() && id == KeyEvent.KEY_PRESSED) { synchronized(listeners) { List<CellEditorListener> list = new ArrayList<CellEditorListener>(listeners); for (CellEditorListener listener : list) { listener.editingStopped(new ChangeEvent(this)); } } } e.consume(); } else { super.processKeyEvent(e); } }
Example 3
Source File: ColumnModels.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void processKeyEvent(KeyEvent e) { KeyStroke ks = KeyStroke.getKeyStrokeForEvent(e); if (enter.equals(ks)) { // Prevent JComponent.processKeyBindings() to be called (it is called from // JComponent.processKeyEvent() ), notify only registered key listeners int id = e.getID(); for (KeyListener keyListener : getKeyListeners()) { switch(id) { case KeyEvent.KEY_TYPED: keyListener.keyTyped(e); break; case KeyEvent.KEY_PRESSED: keyListener.keyPressed(e); break; case KeyEvent.KEY_RELEASED: keyListener.keyReleased(e); break; } } if (!e.isConsumed() && id == KeyEvent.KEY_PRESSED) { synchronized(listeners) { List<CellEditorListener> list = new ArrayList<CellEditorListener>(listeners); for (CellEditorListener listener : list) { listener.editingStopped(new ChangeEvent(this)); } } } e.consume(); } else { super.processKeyEvent(e); } }
Example 4
Source File: KeyboardExtension.java From 07kit with GNU General Public License v3.0 | 5 votes |
/** * Invoked when a key has been released. * See the class description for {@link KeyEvent} for a definition of * a key released event. */ public void keyReleased(KeyEvent e) { for (KeyListener child : children) { child.keyReleased(e); if (e.isConsumed()) { return; } } if (acceptingEvents) { _keyReleased(e); } }
Example 5
Source File: SwingActionTest.java From triplea with GNU General Public License v3.0 | 5 votes |
@Test void testKeyReleaseListener() { final KeyEvent event = mock(KeyEvent.class); final KeyListener action = SwingAction.keyReleaseListener(consumer); action.keyReleased(event); verify(consumer).accept(event); }
Example 6
Source File: QueueJumpingKeyListener.java From SNT with GNU General Public License v3.0 | 5 votes |
@Override public void keyReleased(final KeyEvent e) { for (final KeyListener kl : listeners) { if (e.isConsumed()) break; kl.keyReleased(e); } }
Example 7
Source File: FormulaEditorPanel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Invoked when a key has been released. See the class description for {@link java.awt.event.KeyEvent} for a * definition of a key released event. */ public void keyReleased( final KeyEvent e ) { final KeyListener[] keyListeners = listenerList.getListeners( KeyListener.class ); for ( int i = 0; i < keyListeners.length; i++ ) { final KeyListener keyListener = keyListeners[ i ]; keyListener.keyReleased( e ); } }