Here you can find the source of mapInput(JComponent component, int scope, final int keycode, final int modifiers, final AbstractAction action)
public static void mapInput(JComponent component, int scope, final int keycode, final int modifiers, final AbstractAction action)
//package com.java2s; //License from project: LGPL import javax.swing.*; public class Main { public static void mapInput(JComponent component, int scope, final int keycode, final int modifiers, final AbstractAction action) { if (component instanceof JComponent) { JComponent jc = (JComponent) component; String hash = String.valueOf(System.identityHashCode(action)); jc.getInputMap(scope).put(KeyStroke.getKeyStroke(keycode, modifiers), hash); jc.getActionMap().put(hash, action); }/* www . j a v a 2s . co m*/ } }