2012-10-19 43 views
4

我正在使用Windows和Windows上的Java和SWT。我創建了一個系統托盤。另外,我已將工具提示添加到系統托盤。工具提示正在顯示,但隨後會自動消失,只要我不按下退出按鈕,它就會出現。可能嗎?如何取消自動隱藏工具提示?

ToolTip tip = new ToolTip(shell, SWT.BALLOON | SWT.ICON_INFORMATION); 
tip.setText("Title"); 
tip.setMessage("Test Message."); 
tip.setAutoHide(false); 

TrayItem trayItem = new TrayItem(tray, SWT.NONE); 
trayItem.setImage(icon); 
trayItem.setToolTipText("42GB"); 
trayItem.setToolTip(tip); 
tip.setVisible(true); 
+0

是您'tray'變量設置爲'display.getSystemTray()'? – Secko

回答

1

沒有測試,但我相信你 「只是」 需要刪除trayItem.setToolTipText("42GB"); ...