Java Swing Key Action addActionsToMap(Action[] list1, Map h)

Here you can find the source of addActionsToMap(Action[] list1, Map h)

Description

add a col;lections of actions to a Map where the key is the action name

License

Apache License

Parameter

Parameter Description
list1 non-noll list of actions
h non-null map as above

Declaration

public static void addActionsToMap(Action[] list1, Map<String, Action> h) 

Method Source Code


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

import javax.swing.*;

import java.util.*;

public class Main {
    /**//from w  w w .  ja v a  2  s.c  o  m
     * add a col;lections of actions to a Map where the key is the action name
     *
     * @param list1 non-noll list of actions
     * @param h     non-null map as above
     */
    public static void addActionsToMap(Action[] list1, Map<String, Action> h) {
        for (int i = 0; i < list1.length; i++) {
            Action a = list1[i];
            String value = (String) a.getValue(Action.NAME);
            h.put((value != null ? value : ""), a);
        }
    }
}

Related

  1. addCloseActionWithEscapeKey(final Window window, JRootPane rootPane)
  2. addCtrlEnterAction(JComponent comp, AbstractAction action)
  3. addEnterKey(JComponent control)
  4. addEscKeyAction(javax.swing.JComponent component, javax.swing.InputMap inputMap, javax.swing.Action action)