Java Swing ActionMap fillInputMap(ActionMap am)

Here you can find the source of fillInputMap(ActionMap am)

Description

fill Input Map

License

Apache License

Declaration

public static InputMap fillInputMap(ActionMap am) 

Method Source Code

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

import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.InputMap;

import javax.swing.KeyStroke;

public class Main {
    public static InputMap fillInputMap(ActionMap am) {
        InputMap keysMap = new InputMap();
        if (am != null) {
            Object[] oNames = am.allKeys();
            if (oNames != null) {
                for (int i = 0; i < oNames.length; i++) {
                    Action action = am.get(oNames[i]);
                    Object oKey = action.getValue(Action.ACCELERATOR_KEY);
                    if (oKey != null && oKey instanceof KeyStroke) {
                        keysMap.put((KeyStroke) oKey, oNames[i]);
                    }/*from  w w  w. jav a 2s.co  m*/
                }
            }
        }
        return keysMap;
    }
}

Related

  1. attachAccelerator(Action action, JComponent component)
  2. bindAction(JComponent aComponent, String aCommand, Action anAction)
  3. checkActions(JComponent aComponent)
  4. cloneActionMap(ActionMap original)
  5. dumpActionMap(JComponent comp)
  6. installActions(JComponent comp, Action actions[], int condition)
  7. printActionInputMap(JComponent comp)
  8. printActionMap(ActionMap actionMap, String who)
  9. putAction(Action action)