void (int lastMnemonic, int mnemonic) { if (mnemonic == lastMnemonic) { return; } InputMap windowInputMap = SwingUtilities.getUIInputMap( this, JComponent.WHEN_IN_FOCUSED_WINDOW); int mask = SystemInfo.isMac ? InputEvent.ALT_MASK | InputEvent.CTRL_MASK : InputEvent.ALT_MASK; if (lastMnemonic != 0 && windowInputMap != null) { windowInputMap.remove(KeyStroke.getKeyStroke(lastMnemonic, mask, false)); } if (mnemonic != 0) { if (windowInputMap == null) { windowInputMap = new ComponentInputMapUIResource(this); SwingUtilities.replaceUIInputMap(this, JComponent. WHEN_IN_FOCUSED_WINDOW, windowInputMap); } windowInputMap.put(KeyStroke.getKeyStroke(mnemonic, mask, false), "doClick"); } }