public void unbindKey(String keySequence) { KeyStroke ks = KeyStroke.getKeyStroke(keySequence); if (ks == null) { throw new Error("Invalid key sequence \"" + keySequence + "\""); } textView.getKeymap().removeKeyStrokeBinding(ks); }
public void bindKeyToCommand(String keySequence, LispExpr cmd) { // see Java API for info on keySequence format KeyStroke ks = KeyStroke.getKeyStroke(keySequence); if (ks == null) { throw new Error("Invalid key sequence \"" + keySequence + "\""); } textView.getKeymap().addActionForKeyStroke(ks, new KeyAction(cmd)); }