// creates a CTabItem for a CTabFolder with text "SP 500" (P is underlined)
// and creates a keyboard hotkey for ALT+P to select the CTabItem
CTabItem.setText("S&P 500");
// and creates a keyboard hotkey for ALT+P to select the CTabItem
CTabItem.setText("S&P 500");
The correct way is to double the ampersand literal:
CTabItem.setText("S&&P 500");
Or where you are using a variable:
String label = "S&P 500";
CTabItem.setText(label.replaceAll("&", "&&");
CTabItem.setText(label.replaceAll("&", "&&");