1 | if ((index != -1) && ((index + 1) < text.length())) {↵ | | 1 | if ((index != -1) && ((index + 1) < text.length())) {↵
|
2 | // mnemonic found↵ | | 2 | // mnemonic found↵
|
3 | // ...and not at the end of the string (which doesn't make sence)↵ | | 3 | // ...and not at the end of the string (which doesn't make sence)↵
|
4 | char mnemonic = text.charAt(index + 1);↵ | | 4 | char mnemonic = text.charAt(index + 1);↵
|
|
5 | StringBuffer buf = new StringBuffer();↵ | | 5 | StringBuffer buf = new StringBuffer();↵
|
|
6 | // if mnemonic is first character of this string↵ | | 6 | // if mnemonic is first character of this string↵
|
7 | if (index == 0) {↵ | | 7 | if (index == 0) {↵
|
8 | buf.append(text.substring(1));↵ | | 8 | buf.append(text.substring(1));↵
|
9 | } else {↵ | | 9 | } else {↵
|
10 | buf.append(text.substring(0, index));↵ | | 10 | buf.append(text.substring(0, index));↵
|
11 | buf.append(text.substring(index + 1));↵ | | 11 | buf.append(text.substring(index + 1));↵
|
12 | }↵ | | 12 | }↵
|
|
13 | // set display text↵ | | 13 | // set display text↵
|
14 | component.setText(buf.toString());↵ | | 14 | label.setText(buf.toString());↵
|
|
15 | // set mnemonic↵ | | 15 | // set mnemonic↵
|
16 | component.setMnemonic(mnemonic);↵ | | 16 | label.setDisplayedMnemonic(mnemonic);↵
|
17 | component.setDisplayedMnemonicIndex(index);↵ | | 17 | label.setDisplayedMnemonicIndex(index);↵
|
18 | } else {↵ | | 18 | } else {↵
|
19 | // no mnemonic found - just set the text on the menu item↵ | | 19 | // no mnemonic found - just set the text on the menu item↵
|
20 | component.setText(text);↵ | | 20 | label.setText(text);↵
|
21 | } | | 21 | }
|