tags:

views:

28

answers:

1

Hello!

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

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

A: 

I haven't tried this, but since TrayItem extends Item, which is an instance of Widget, why not try this:

Tray tray = display.getSystemTray();
TrayItem trayItem = new TrayItem(tray, SWT.NONE);
Rectangle bounds = trayItem.getDisplay().getBounds();
Paul Lammertsma
Hello, Paul.Thank you for the answer! But I try it and it seems that for tray item it does't work. I found next solution (but it's platform dependent):int itemHandle = trayItem.handle; GdkRectangle areaRectangle = new GdkRectangle();OS.gtk_status_icon_get_geometry(itemHandle, 0, areaRectangle, 0);windowX = areaRectangle.x;windowY = areaRectangle.y;Best regards!Alex
Alex