Kill an existing binding from the given condition. If the binding is defined on the given component, it is removed, but if it is defined through a parent inputmap (typically shared by multiple components, so best not touched), this adds a dummy binding for this component, that will never match an ac
(final JComponent component,
final KeyStroke keystroke, int condition)
| 133 | * such a binding would get re-enabled when the action is re-enabled. |
| 134 | */ |
| 135 | public static void killBinding(final JComponent component, |
| 136 | final KeyStroke keystroke, int condition) { |
| 137 | InputMap map = component.getInputMap(condition); |
| 138 | // First, try removing it |
| 139 | map.remove(keystroke); |
| 140 | // If the binding is defined in a parent map, defining it will not work, so |
| 141 | // instead add an override that will never appear in the action map. |
| 142 | if (map.get(keystroke) != null) |
| 143 | map.put(keystroke, new Object()); |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Kill an existing binding like above, but from all three conditions |