Java Code Examples for javax.swing.ActionMap#setParent()

The following examples show how to use javax.swing.ActionMap#setParent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextRegionManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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 };
}
 
Example 2
Source File: BasicLookAndFeel.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 3
Source File: BasicLookAndFeel.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 4
Source File: BasicLookAndFeel.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 5
Source File: BasicLookAndFeel.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 6
Source File: BasicLookAndFeel.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 7
Source File: BasicLookAndFeel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 8
Source File: BasicLookAndFeel.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 9
Source File: BasicLookAndFeel.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 10
Source File: BasicLookAndFeel.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 11
Source File: BasicLookAndFeel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 12
Source File: BasicLookAndFeel.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 13
Source File: BasicLookAndFeel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 14
Source File: CloneableEditorInitializer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 15
Source File: BasicLookAndFeel.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 16
Source File: BasicLookAndFeel.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 17
Source File: BasicLookAndFeel.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 18
Source File: BasicLookAndFeel.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 19
Source File: BasicLookAndFeel.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
    }
}