public static MnemonicWrapper<?> getWrapper(Component component) {
    if (component == null || ClientProperty.isTrue(component, MnemonicHelper.DISABLE_MNEMONIC_PROCESSING)) {
      return null;
    }
    for (PropertyChangeListener listener : component.getPropertyChangeListeners()) {
      if (listener instanceof MnemonicWrapper<?> wrapper) {
        wrapper.run(); // update mnemonics immediately
        return wrapper;
      }
    }
    if (component instanceof JMenuItem) {
      return new MenuWrapper((AbstractButton)component);
    }
    if (component instanceof AbstractButton) {
      return new ButtonWrapper((AbstractButton)component);
    }
    if (component instanceof JLabel) {
      return new LabelWrapper((JLabel)component);
    }
    return null;
  }
public static MnemonicWrapper<?> getWrapper(Component component)