// This means that the menu item has been garbage collected.
// Remove this listener from the action:
Action action = (Action) evt.getSource();
action.removePropertyChangeListener(this);
} else if (btn instanceof ToggleActionRadioButtonMenuItem) {
ToggleAction action = (ToggleAction) getActionListenedTo();
((ToggleActionRadioButtonMenuItem) btn).setSelected(action.isSelected());
}
}
}