2014-09-03 65 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

我创建了一个应用程序窗口(不可见,不打开),打开我的主壳从它的孩子和创建工具提示为不可见的应用程序窗口的孩子。我不知道它是否是真正的解决方案,但它现在可行。