2014-09-03 64 views
1

我使用openNotifi方法在托盤圖標上創建氣球工具提示,但它們在外殼被圖標化時也會最小化。我怎麼才能顯示通知工具提示,即使殼被圖標化?SWT氣球工具提示在圖標化外殼

public void openNotifi() {  
    final ToolTip tip = new ToolTip(shell, SWT.BALLOON 
      | SWT.ICON_INFORMATION); 
    tip.setMessage("Here is a message for the user. When the message is too long it wraps. I should say something cool but nothing comes to my mind."); 
    Tray tray = shell.getDisplay().getSystemTray(); 
    if (tray != null) { 
     TrayItem item = new TrayItem(tray, SWT.NONE); 
     ; 
     tip.setText("Notification from a tray item"); 
     item.setToolTip(tip); 
    } else { 
     tip.setText("Notification from anywhere"); 
     tip.setLocation(100, 400); 
    } 
    tip.setVisible(true); 
} 

和呼喚它通過

Display.getDefault().syncExec(new Runnable() { 
public void run() { 
try { 
    if (current_username != sender) { 
     openNotifi(); 
    } 
} 
} 
}); 

回答

0

我創建了一個應用程序窗口(不可見,不打開),打開我的主殼從它的孩子和創建工具提示爲不可見的應用程序窗口的孩子。我不知道它是否是真正的解決方案,但它現在可行。