TextWithMnemonic (String text) { int mnemonicIndex = UIUtil.getDisplayMnemonicIndex(text); return mnemonicIndex != -1 ? new TextWithMnemonic(text.substring(0, mnemonicIndex) + text.substring(mnemonicIndex + 1), mnemonicIndex) : new TextWithMnemonic(text, -1); }