我配置系統托盤的圖標,下面的代碼「SWT」字符串:SWT系統托盤 - Linux的GTK侏儒托盤圖標上盤
/**
* 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);
}
});
}
}
托盤設置OK,但STRING「SWT」是作爲標籤出現在托盤圖標一側。
系統是Fedora Core 17(GNOME)。
這是一個平臺問題還是有辦法改變文本?
下面是截圖:
您可以添加屏幕截圖嗎? – Baz
我沒有添加屏幕截圖的權限。但在Gnome系統托盤中,當我在eclipse中運行時,會發生以下情況:[IMG TRAY] SWT – davidfdr
是的,我知道。只要將它上傳到其他地方併發布鏈接即可。然後我可以在這裏包括它。 – Baz