[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[platform-swt-dev] Label ampersand in text
|
- From: "Nazarenus, Jens" <Jens.Nazarenus@xxxxxxxxxxx>
- Date: Mon, 22 Mar 2010 09:54:26 +0100
- Accept-language: de-DE
- Acceptlanguage: de-DE
- Delivered-to: platform-swt-dev@eclipse.org
- Thread-index: AcrJnUaJA1x23SwITiWhpkgNWYkKXw==
- Thread-topic: Label ampersand in text
Hi,
I am developing a SWT application using org.eclipse.swt.widgets.Label.
When I include an ampersand <&> with label.setText("my company GmbH & Co. KG"); the character is not shown correctly.
Mostly an underline <_> is shown instead of the ampersand. It seems that SWT interprets the ampersand as the mnemonic character for the label.
What I have done:
I wrote a method which is invoked after setting the text for the label control.
public static void fixMnemonic(Label l) {
String text = l.getText();
l.setText(text.replaceAll("&", "&&"));
}
It works. But I am not happy with this solution.
Is there another way to bypass this issue?
Regards