if (needToAdd) {
if (needToRemove && wasInputMap) {
im.remove(KeyStroke.getKeyStroke(lastFocusAccelerator,
InputEvent.ALT_DOWN_MASK));
} else if (!wasInputMap) {
im = new ComponentInputMapUIResource(component);
im.put(KeyStroke.getKeyStroke(accelerator,
InputEvent.ALT_DOWN_MASK),
FOCUS_ACTION_NAME);
if (!wasInputMap) {
SwingUtilities.replaceUIInputMap(component,