void (JComponent component, String type) { if (SystemInfo.isMac && Registry.is("ide.mac.alt.mnemonic.without.ctrl")) { // hack to make component's mnemonic work for ALT+KEY_CODE on Macs. // Default implementation uses ALT+CTRL+KEY_CODE (see BasicLabelUI). InputMap inputMap = component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); if (inputMap != null) { KeyStroke[] strokes = inputMap.allKeys(); if (strokes != null) { int mask = InputEvent.ALT_MASK | InputEvent.CTRL_MASK; for (KeyStroke stroke : strokes) { if (mask == (mask & stroke.getModifiers())) { inputMap.put(getKeyStrokeWithoutCtrlModifier(stroke), type != null ? type : inputMap.get(stroke)); } } } } } }