SWT TrayItem 位置 [英] SWT TrayItem location

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

问题描述

我使用 SWT + JFace 并希望在托盘图标附近显示我的应用程序窗口,如工具提示.

I use SWT + JFace and want to show my application window near the tray icon, like ToolTip.

有没有办法获取 TrayItem 的位置?

Is there a way to get the location of a TrayItem?

推荐答案

没有与平台无关的方法来执行此 AFAIK.如果您真的需要它,您可能需要根据您的 GTK 示例对底层 SWT 平台 API 进行编码.我在任何地方构建/运行的一种方法是使用反射来调用基于 SWT.getPlatform () 返回的方法.

There's no platform-agnostic way to do this AFAIK. Ig you really need it, you'll likely need to code to the underlying SWT platform API as per your GTK example. One way I've done this which builds/runs everywhere is to use reflection to call the methods based on what SWT.getPlatform () returns.

如果窗口是鼠标触发的(例如通过悬停),您可以考虑使用鼠标位置作为悬停的基本位置.

If the window is mouse-triggered (e.g. by hover) you could consider using the mouse location as the base location for the hover.

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

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