Java Swing KeyStroke mapKeyStrokeAction(JComponent component, String actionMapKey, Action action, KeyStroke keyStroke)

Here you can find the source of mapKeyStrokeAction(JComponent component, String actionMapKey, Action action, KeyStroke keyStroke)

Description

map Key Stroke Action

License

Apache License

Declaration

public static void mapKeyStrokeAction(JComponent component, String actionMapKey, Action action,
            KeyStroke keyStroke) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.KeyStroke;

public class Main {
    public static void mapKeyStrokeAction(JComponent component, String actionMapKey, Action action,
            KeyStroke keyStroke) {
        component.getActionMap().put(actionMapKey, action);
        component.getInputMap().put(keyStroke, actionMapKey);
    }/*from www .  j a va2 s .c  om*/
}

Related

  1. installKeyBinding(JComponent c, int condition, String actionName, Action action, KeyStroke... keyStrokes)
  2. installKeyBindings()
  3. installKeystrokes(JComponent component, Action... actions)
  4. isKeyStroke(String propClass)
  5. mapInput(JComponent component, int scope, final int keycode, final int modifiers, final AbstractAction action)
  6. mapKeyStrokeToAction(final JComponent comp, final String ks, final String name, final AbstractAction action)
  7. mapKeyStrokeToButton(final JComponent comp, final String ks, final String name, final AbstractButton button)
  8. maybeInstall(InputMap map, String action, KeyStroke stroke)
  9. refleshAction(JComponent com, KeyStroke keyStroke)