Here you can find the source of getInstalledOperation(final RootPaneContainer frame, final Object actionKey, boolean selfOnly)
Parameter | Description |
---|---|
frame | The frame in which the action is installed |
actionKey | The action key to which the action is bound |
selfOnly | If true, will only check the frame specified in argument for actions bound to the action key. If false, will check any parents of the action map for actions bound to the action key, if none was found in the first one. |
public static Action getInstalledOperation(final RootPaneContainer frame, final Object actionKey, boolean selfOnly)
//package com.java2s; //License from project: Open Source License import javax.swing.Action; import javax.swing.ActionMap; import javax.swing.JRootPane; import javax.swing.RootPaneContainer; public class Main { /**/*from w w w. j a va 2s .c o m*/ * Returns the Action installed under the specified action key in the specified frame. * * @param frame * The frame in which the action is installed * @param actionKey * The action key to which the action is bound * @param selfOnly * If true, will only check the frame specified in argument for actions bound * to the action key. * If false, will check any parents of the action map for actions bound to the * action key, if none was found in the first one. */ public static Action getInstalledOperation(final RootPaneContainer frame, final Object actionKey, boolean selfOnly) { JRootPane root = frame.getRootPane(); if (selfOnly) { ActionMap actionMap = root.getActionMap(); ActionMap parentMap = actionMap.getParent(); actionMap.setParent(null); Action result = actionMap.get(actionKey); actionMap.setParent(parentMap); return result; } else { return root.getActionMap().get(actionKey); } } }