当前位置: 首页>>代码示例>>Java>>正文


Java ActionMap.setParent方法代码示例

本文整理汇总了Java中javax.swing.ActionMap.setParent方法的典型用法代码示例。如果您正苦于以下问题:Java ActionMap.setParent方法的具体用法?Java ActionMap.setParent怎么用?Java ActionMap.setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.ActionMap的用法示例。


在下文中一共展示了ActionMap.setParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: installOverrideActionMap

import javax.swing.ActionMap; //导入方法依赖的package包/类
public static ActionMap [] installOverrideActionMap(JTextComponent component) {
    ActionMap origActionMap = component.getActionMap();
    ActionMap actionMap = new ActionMap();
    OverrideAction[] actions = new OverrideAction[]{
        new OverrideAction(TAB),
        new OverrideAction(SHIFT_TAB),
        new OverrideAction(ENTER),
    };

    // Install the actions into new action map
    for (OverrideAction action : actions) {
        Object actionKey = (String) action.getValue(Action.NAME);
        assert (actionKey != null);
        // Translate to the real key in the action map
        actionKey = action.findActionKey(component);
        if (actionKey != null) { // == null may happen during unit tests
            Action origAction = origActionMap.get(actionKey);
            action.putValue(ORIGINAL_ACTION_PROPERTY, origAction);
            actionMap.put(actionKey, action);
        }
    }
    actionMap.setParent(origActionMap);
    // Install the new action map and return the original action map
    component.setActionMap(actionMap);
    return new ActionMap [] { origActionMap, actionMap };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:TextRegionManager.java

示例2: initCustomEditorAndDecorationsInEDT

import javax.swing.ActionMap; //导入方法依赖的package包/类
private boolean initCustomEditorAndDecorationsInEDT() {
    initCustomEditor();
    initDecoration();
    editor.remove(loadingLabel);
    ((QuietEditorPane)pane).setWorking(QuietEditorPane.ALL);
    // set the caret to right possition if this component was deserialized
    int cursorPosition = editor.getCursorPosition();
    if (cursorPosition != -1) {
        Caret caret = pane.getCaret();
        if (caret != null) {
            caret.setDot(cursorPosition);
        }
    }
    ActionMap actionMap = editor.getActionMap();
    ActionMap p = actionMap.getParent();
    actionMap.setParent(null);
    actionMap.setParent(p);

    //#134910: If editor TopComponent is already activated request focus
    //to it again to get focus to correct subcomponent eg. QuietEditorPane which
    //is added above.
    if (shouldRequestFocus(pane)) {
        EDITOR_LOG.log(Level.FINE, "requestFocusInWindow {0}", pane);
        editor.requestFocusInWindow();
    }
    //#162961, #167289: Force repaint of editor. Sometimes editor stays empty.
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            editor.revalidate();
        }
    });

    // Mark the initialization finished here so that CloneableEditor.isEditorPaneReady() returns true
    // Do it before custom editor and decorations since they might query getEditorPane()
    // which would wait indeinitely for initialization completion.
    finishInitialization();
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:CloneableEditorInitializer.java

示例3: setupKeymap

import javax.swing.ActionMap; //导入方法依赖的package包/类
private void setupKeymap(Set<Action> actions) {
JComponent comp = term.getScreen();

ActionMap actionMap = comp.getActionMap();
ActionMap newActionMap = new ActionMap();
newActionMap.setParent(actionMap);

printActionMap(actionMap);

InputMap inputMap = comp.getInputMap();
InputMap newInputMap = new InputMap();
newInputMap.setParent(inputMap);

Set<KeyStroke> passKeystrokes = new HashSet<KeyStroke>();

for (Action a : actions) {
    String name = (String) a.getValue(Action.NAME);
           KeyStroke accelerator = (KeyStroke) a.getValue(Action.ACCELERATOR_KEY);
    System.out.printf("Registering %s for %s\n", accelerator, name);
    if (accelerator == null)
	continue;
    newInputMap.put(accelerator, name);
    newActionMap.put(name, a);
    passKeystrokes.add(accelerator);
}

comp.setActionMap(newActionMap);
comp.setInputMap(JComponent.WHEN_FOCUSED, newInputMap);

       term.setKeyStrokeSet((HashSet) passKeystrokes);
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:Terminal.java

示例4: installAudioActionMap

import javax.swing.ActionMap; //导入方法依赖的package包/类
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:BasicLookAndFeel.java


注:本文中的javax.swing.ActionMap.setParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。