boolean (@Nullable Component component, int keyCode) { if (component instanceof AbstractButton) { return ((AbstractButton)component).getMnemonic() == keyCode; } if (component instanceof JLabel) { return ((JLabel)component).getDisplayedMnemonic() == keyCode; } IntPredicate checker = ClientProperty.get(component, MNEMONIC_CHECKER); return checker != null && checker.test(keyCode); }