Java Code Examples for java.awt.Component#removeKeyListener()
The following examples show how to use
java.awt.Component#removeKeyListener() .
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: ReplaceDialog.java From visualvm with GNU General Public License v2.0 | 6 votes |
private void registerKeyAction(Component c) { if (c instanceof ReplaceDialog == false) { c.removeKeyListener(this); c.addKeyListener(this); } if (c instanceof Container) { Container cnt = (Container) c; cnt.removeContainerListener(this); cnt.addContainerListener(this); Component[] ch = cnt.getComponents(); for (int i = 0; i < ch.length; i++) { registerKeyAction(ch[i]); } } }
Example 2
Source File: EscapableDialog.java From rest-client with Apache License 2.0 | 6 votes |
private void registerKeyAction(Component c) { if (c instanceof EscapableDialog == false) { c.removeKeyListener(this); c.addKeyListener(this); } if (c instanceof Container) { Container cnt = (Container) c; cnt.removeContainerListener(this); cnt.addContainerListener(this); Component[] ch = cnt.getComponents(); for (int i = 0; i < ch.length; i++) { registerKeyAction(ch[i]); } } }
Example 3
Source File: BaselineCorrectorSetupDialog.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
private void unset_VK_ESCAPE_KeyListener() { // Remove VK_ESCAPE KeyEvent listeners List<Component> comps = BaselineCorrectorSetupDialog.getAllComponents(BaselineCorrectorSetupDialog.this); for (Component c : comps) { c.removeKeyListener(BaselineCorrectorSetupDialog.this.keyListener); } }
Example 4
Source File: ClarifyingKeyListener.java From SNT with GNU General Public License v3.0 | 5 votes |
private void removeKeyAndContainerListenerRecursively(final Component c) { c.removeKeyListener(this); if (c instanceof Container) { final Container container = (Container) c; container.removeContainerListener(this); final Component[] children = container.getComponents(); for (int i = 0; i < children.length; i++) { removeKeyAndContainerListenerRecursively(children[i]); } } }
Example 5
Source File: SimpleNeuriteTracer.java From SNT with GNU General Public License v3.0 | 5 votes |
/** * This method will remove the existing keylisteners from the component 'c', * tells 'firstKeyListener' to call those key listeners if it has not dealt * with the key, and then sets 'firstKeyListener' as the key listener for * 'c' */ public static void setAsFirstKeyListener(final Component c, final QueueJumpingKeyListener firstKeyListener) { final KeyListener[] oldKeyListeners = c.getKeyListeners(); for (final KeyListener kl : oldKeyListeners) { c.removeKeyListener(kl); } firstKeyListener.addOtherKeyListeners(oldKeyListeners); c.addKeyListener(firstKeyListener); }