我正在使用以下代码配置系统托盘图标:
/**
* Configura os ícones da shell principal
*/
protected void setDiplayIcons(Shell shell){
Display display = shell.getDisplay();
InputStream inputImgTray = getClass().getClassLoader().getResourceAsStream(ImagensNaNOffline.IMG_LOGO_SEBRAE.getPath());
Image image = new Image(display, inputImgTray);
shell.setImage(image);
Tray tray = display.getSystemTray();
final ToolTip tip = new ToolTip(shell, SWT.BALLOON | SWT.ICON_INFORMATION);
tip.setMessage("Balloon Message Goes Here!");
if(tray != null) {
TrayItem trayItem = new TrayItem(tray, SWT.NONE);
trayItem.setImage(image);
tip.setText("Balloon Title goes here.");
trayItem.setToolTip(tip);
final Menu menu = new Menu(shell, SWT.POP_UP);
MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText("Button A");
menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText("Button B");
menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText("Show Tooltip");
menuItem.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event e) {
tip.setVisible(true);
}
});
trayItem.addListener (SWT.MenuDetect, new Listener () {
public void handleEvent (Event event) {
menu.setVisible (true);
}
});
}
}
托盘设置正常,但字符串“SWT”作为标签出现在托盘图标的一侧。
系统是 Fedora Core 17 (GNOME)。
这是平台问题还是有办法更改文本?
这是一个屏幕截图: