focusedWindowMap.put(menuItem.getAccelerator(), "doClick");
KeyStroke accelerator = menuItem.getAccelerator(); if (accelerator != null) focusedWindowMap.put(accelerator, "doClick");
  protected void installKeyboardActions()  {    InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);    if (focusedWindowMap == null)      focusedWindowMap = new ComponentInputMapUIResource(menuItem);    focusedWindowMap.put(menuItem.getAccelerator(), "doClick");    SwingUtilities.replaceUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW, focusedWindowMap);        ActionMap UIActionMap = SwingUtilities.getUIActionMap(menuItem);    if (UIActionMap == null)      UIActionMap = new ActionMapUIResource();    UIActionMap.put("doClick", new ClickAction());    SwingUtilities.replaceUIActionMap(menuItem, UIActionMap);  }