OSX中的SWT SystemTray [英] SWT SystemTray in OSX

查看:84
本文介绍了OSX中的SWT SystemTray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图在我的Snow Leopard Java应用程序中添加一个系统任务栏图标,它似乎运行得很好.不幸的是,SWT似乎没有将系统托盘图标与顶部菜单栏对齐,而是将其与鼠标单击的位置对齐

I'm trying to add a system tray icon to my Snow Leopard java application, which seems to work fairly well. Unfortunately, it seems like SWT does not align the systemtray icon with the top menubar, but instead aligns it with where my mouse clicked

(例如 http://kobyleha.com/files/azureus_2_250.png 而不是 http://kobyleha.com/files/power_250.png ...我正在借用图片,因为此网站描述了类似的问题) 自3.3以来,SWT似乎一直存在问题.我想知道是否有人可以分享一些好的解决方法?

(e.g. http://kobyleha.com/files/azureus_2_250.png instead of http://kobyleha.com/files/power_250.png ... I am borrowing the images since this site describes similar problems) It seems to have been a problem with SWT since 3.3. I'm wondering if there are any good workarounds available that someone could share?

谢谢!

推荐答案

我知道距您提出问题已经很久了,但是

I know it's been long since you asked the question, but here's what works for me at least.

生命线是item.setToolTip(tip);,它将使气球与托盘项目对齐.

The vital line is item.setToolTip(tip); which will align the balloon to the tray item.

if (tray != null) {
    TrayItem item = new TrayItem(tray, SWT.NONE);
    image = display.getSystemImage(SWT.ICON_INFORMATION);
    item.setImage(image);
    tip.setText("Notification from a tray item");
    item.setToolTip(tip); // <<<-----
}

这篇关于OSX中的SWT SystemTray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆