void (Component component) { if (component instanceof AbstractButton) { component.addPropertyChangeListener(AbstractButton.TEXT_CHANGED_PROPERTY, ourTextPropertyListener); DialogUtil.registerMnemonic((AbstractButton)component); checkForDuplicateMnemonics((AbstractButton)component); fixMacMnemonicKeyStroke((JComponent)component, null); } else if (component instanceof JLabel) { component.addPropertyChangeListener(TEXT_CHANGED_PROPERTY, ourTextPropertyListener); DialogUtil.registerMnemonic((JLabel)component, null); checkForDuplicateMnemonics((JLabel)component); fixMacMnemonicKeyStroke((JComponent)component, "release"); // "release" only is OK for labels } else if (component instanceof ActionButtonComponent) { fixMacMnemonicKeyStroke((JComponent)component, null); } }