int i=0, j=0, mnemonic=0; while (i < text.length) { if ((text [j++] = text [i++]) == Mnemonic) { if (i == text.length) {continue;} if (text [i] == Mnemonic) {i++; continue;} if (mnemonic == 0) mnemonic = text [i]; j--; } } while (j < text.length) text [j++] = 0;
int mnemonic = fixMnemonic (text);
public void setText (String string) {	checkWidget();	if (string == null) error (SWT.ERROR_NULL_ARGUMENT);	if ((style & SWT.ARROW) != 0) return;	char [] text = new char [string.length ()];	string.getChars (0, text.length, text, 0);	int i=0, j=0, mnemonic=0;	while (i < text.length) {		if ((text [j++] = text [i++]) == Mnemonic) {			if (i == text.length) {continue;}			if (text [i] == Mnemonic) {i++; continue;}			if (mnemonic == 0) mnemonic = text [i];			j--;		}	}	while (j < text.length) text [j++] = 0;	byte [] buffer = Converter.wcsToMbcs (getCodePage (), text, true);	int xmString = OS.XmStringParseText (		buffer,		0,		OS.XmFONTLIST_DEFAULT_TAG, 		OS.XmCHARSET_TEXT, 		null,		0,		0);		if (xmString == 0) error (SWT.ERROR_CANNOT_SET_TEXT);	if (mnemonic == 0) mnemonic = OS.XK_VoidSymbol;	int [] argList = {		OS.XmNlabelType, OS.XmSTRING,		OS.XmNlabelString, xmString,		OS.XmNmnemonic, mnemonic,	};	OS.XtSetValues (handle, argList, argList.length / 2);	if (xmString != 0) OS.XmStringFree (xmString);}