次のコードを使用して、システム トレイ アイコンを構成しています。
/**
* 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);
}
});
}
}
トレイは正常に設定されていますが、STRING "SWT" がトレイ アイコンの横にラベルとして表示されています。
システムは Fedora Core 17 (GNOME) です。
プラットフォームの問題ですか、それともテキストを変更する方法はありますか?
スクリーンショットは次のとおりです。